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