-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 @@ -86,5 +86,5 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) doPopulate=true; QVBoxLayout *vbox = new QVBoxLayout( this,0, -1, "Vlayout" ); - QHBoxLayout *hbox = new QHBoxLayout( this ); + QHBoxLayout *hbox = new QHBoxLayout( this, 0, -1, "HLayout" ); view = new QMultiLineEdit(this, "OpieNotesView"); @@ -109,4 +109,9 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) newButton->setText(tr("New")); hbox->addWidget( newButton); + + deleteButton= new QPushButton( this, "deleteButton" ); + deleteButton->setText(tr("Delete")); + hbox->addWidget( deleteButton); + vbox->addItem(hbox); @@ -118,4 +123,5 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) connect(view,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) ); connect(newButton, SIGNAL(clicked()), this, SLOT(slotNewButton())); + connect(deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButton())); populateBox(); load(); @@ -125,6 +131,9 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) void NotesControl::slotDeleteButton() { + QString selectedText = box->currentText(); qDebug("deleting "+selectedText); + + if( !selectedText.isEmpty()) { Config cfg("Notes"); cfg.setGroup("Docs"); @@ -152,4 +161,5 @@ void NotesControl::slotDeleteButton() { } populateBox(); + } } @@ -248,11 +258,12 @@ void NotesControl::save() { oldDocName=docname; edited=false; + qDebug("save"); + if (doPopulate) + populateBox(); } - qDebug("save"); - if (doPopulate) - populateBox(); - } cfg.writeEntry( "LastDoc",oldDocName ); cfg.write(); + + } } @@ -276,7 +287,7 @@ void NotesControl::populateBox() { void NotesControl::load() { - Config cfg("Notes"); - cfg.setGroup("Docs"); if(!loaded) { + Config cfg("Notes"); + cfg.setGroup("Docs"); QString lastDoc=cfg.readEntry( "LastDoc",""); DocLnk nf; @@ -287,7 +298,7 @@ void NotesControl::load() { loaded=true; oldDocName=lastDoc; - } - cfg.writeEntry( "LastDoc",oldDocName ); - cfg.write(); + cfg.writeEntry( "LastDoc",oldDocName ); + cfg.write(); + } } @@ -350,4 +361,5 @@ void NotesApplet::mousePressEvent( QMouseEvent *) { vc->populateBox(); vc->doPopulate=false; + vc->loaded=false; vc->load(); |