40
40
using namespace KSpread;
42
42
CommentDialog::CommentDialog(QWidget* parent, Selection* selection)
45
setCaption( i18n("Cell Comment") );
47
setButtons( Ok|Cancel);
45
setCaption(i18n("Cell Comment"));
47
setButtons(Ok | Cancel);
49
49
m_selection = selection;
51
51
QWidget *page = new QWidget();
52
setMainWidget( page );
53
QVBoxLayout *lay1 = new QVBoxLayout( page );
53
QVBoxLayout *lay1 = new QVBoxLayout(page);
54
54
lay1->setMargin(KDialog::marginHint());
55
55
lay1->setSpacing(KDialog::spacingHint());
57
multiLine = new KTextEdit( page );
57
multiLine = new KTextEdit(page);
58
58
lay1->addWidget(multiLine);
60
60
multiLine->setFocus();
62
62
const QString comment = Cell(m_selection->activeSheet(), m_selection->marker()).comment();
63
if ( !comment.isEmpty() )
64
multiLine->setText( comment );
63
if (!comment.isEmpty())
64
multiLine->setText(comment);
66
connect( this, SIGNAL( okClicked() ), this, SLOT( slotOk() ) );
67
connect(multiLine, SIGNAL(textChanged ()),this, SLOT(slotTextChanged()));
66
connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
67
connect(multiLine, SIGNAL(textChanged()), this, SLOT(slotTextChanged()));
70
resize( 400, height() );
70
resize(400, height());
73
73
void CommentDialog::slotTextChanged()
75
enableButtonOk( !multiLine->toPlainText().isEmpty());
75
enableButtonOk(!multiLine->toPlainText().isEmpty());
78
78
void CommentDialog::slotOk()