kspread
kspread_dlg_comment.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <qmultilineedit.h>
00025 #include <qpushbutton.h>
00026 #include <qlayout.h>
00027
00028 #include <klocale.h>
00029 #include <kbuttonbox.h>
00030
00031 #include "kspread_canvas.h"
00032 #include "kspread_doc.h"
00033 #include "selection.h"
00034 #include "kspread_sheet.h"
00035 #include "kspread_view.h"
00036
00037 #include "kspread_dlg_comment.h"
00038
00039 using namespace KSpread;
00040
00041 CommentDialog::CommentDialog( View* parent, const char* name,const QPoint &_marker)
00042 : KDialogBase( parent, name,TRUE,i18n("Cell Comment"),Ok|Cancel )
00043 {
00044 m_pView = parent;
00045 marker= _marker;
00046 QWidget *page = new QWidget( this );
00047 setMainWidget(page);
00048 QVBoxLayout *lay1 = new QVBoxLayout( page, 0, spacingHint() );
00049
00050 multiLine = new QMultiLineEdit( page );
00051 lay1->addWidget(multiLine);
00052
00053 multiLine->setFocus();
00054
00055
00056 Cell *cell = m_pView->activeSheet()->cellAt( m_pView->canvasWidget()->markerColumn(), m_pView->canvasWidget()->markerRow() );
00057 if(!cell->format()->comment(marker.x(),marker.y()).isEmpty())
00058 multiLine->setText(cell->format()->comment(marker.x(),marker.y()));
00059
00060 connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
00061 connect(multiLine, SIGNAL(textChanged ()),this, SLOT(slotTextChanged()));
00062
00063 slotTextChanged();
00064
00065 resize( 400, height() );
00066 }
00067
00068 void CommentDialog::slotTextChanged()
00069 {
00070 enableButtonOK( !multiLine->text().isEmpty());
00071 }
00072
00073 void CommentDialog::slotOk()
00074 {
00075 m_pView->doc()->emitBeginOperation( false );
00076 m_pView->activeSheet()->setSelectionComment( m_pView->selectionInfo(),
00077 multiLine->text().stripWhiteSpace() );
00078 m_pView->slotUpdateView( m_pView->activeSheet(), *m_pView->selectionInfo() );
00079
00080 accept();
00081 }
00082
00083 #include "kspread_dlg_comment.moc"
|