-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index a4aa093..cc5245c 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp @@ -87,3 +87,3 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) QVBoxLayout *vbox = new QVBoxLayout( this,0, -1, "Vlayout" ); - QHBoxLayout *hbox = new QHBoxLayout( this ); + QHBoxLayout *hbox = new QHBoxLayout( this, 0, -1, "HLayout" ); @@ -110,2 +110,7 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) hbox->addWidget( newButton); + + deleteButton= new QPushButton( this, "deleteButton" ); + deleteButton->setText(tr("Delete")); + hbox->addWidget( deleteButton); + vbox->addItem(hbox); @@ -119,2 +124,3 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) connect(newButton, SIGNAL(clicked()), this, SLOT(slotNewButton())); + connect(deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButton())); populateBox(); @@ -126,4 +132,7 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) void NotesControl::slotDeleteButton() { + QString selectedText = box->currentText(); qDebug("deleting "+selectedText); + + if( !selectedText.isEmpty()) { Config cfg("Notes"); @@ -153,2 +162,3 @@ void NotesControl::slotDeleteButton() { populateBox(); + } } @@ -249,9 +259,10 @@ void NotesControl::save() { edited=false; + qDebug("save"); + if (doPopulate) + populateBox(); } - qDebug("save"); - if (doPopulate) - populateBox(); - } cfg.writeEntry( "LastDoc",oldDocName ); cfg.write(); + + } } @@ -277,5 +288,5 @@ void NotesControl::load() { - Config cfg("Notes"); - cfg.setGroup("Docs"); if(!loaded) { + Config cfg("Notes"); + cfg.setGroup("Docs"); QString lastDoc=cfg.readEntry( "LastDoc",""); @@ -288,5 +299,5 @@ void NotesControl::load() { oldDocName=lastDoc; - } - cfg.writeEntry( "LastDoc",oldDocName ); - cfg.write(); + cfg.writeEntry( "LastDoc",oldDocName ); + cfg.write(); + } } @@ -351,2 +362,3 @@ void NotesApplet::mousePressEvent( QMouseEvent *) { vc->doPopulate=false; + vc->loaded=false; |