summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-09-22 13:22:51 (UTC)
committer llornkcor <llornkcor>2002-09-22 13:22:51 (UTC)
commit0816ba0c42df8074d698b60041993dbda5591e27 (patch) (unidiff)
treec8688bedc4bf5a87e967b0ede8218997dbdd4071
parent2778d4b110b6b9106da568eb10568af18e482900 (diff)
downloadopie-0816ba0c42df8074d698b60041993dbda5591e27.zip
opie-0816ba0c42df8074d698b60041993dbda5591e27.tar.gz
opie-0816ba0c42df8074d698b60041993dbda5591e27.tar.bz2
delete button so I dont have to explain so much about the hold-menu delete
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/notesapplet/notes.cpp32
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 )
86 doPopulate=true; 86 doPopulate=true;
87 QVBoxLayout *vbox = new QVBoxLayout( this,0, -1, "Vlayout" ); 87 QVBoxLayout *vbox = new QVBoxLayout( this,0, -1, "Vlayout" );
88 QHBoxLayout *hbox = new QHBoxLayout( this ); 88 QHBoxLayout *hbox = new QHBoxLayout( this, 0, -1, "HLayout" );
89 89
90 view = new QMultiLineEdit(this, "OpieNotesView"); 90 view = new QMultiLineEdit(this, "OpieNotesView");
@@ -109,4 +109,9 @@ NotesControl::NotesControl( QWidget *parent, const char *name )
109 newButton->setText(tr("New")); 109 newButton->setText(tr("New"));
110 hbox->addWidget( newButton); 110 hbox->addWidget( newButton);
111
112 deleteButton= new QPushButton( this, "deleteButton" );
113 deleteButton->setText(tr("Delete"));
114 hbox->addWidget( deleteButton);
115
111 vbox->addItem(hbox); 116 vbox->addItem(hbox);
112 117
@@ -118,4 +123,5 @@ NotesControl::NotesControl( QWidget *parent, const char *name )
118 connect(view,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) ); 123 connect(view,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) );
119 connect(newButton, SIGNAL(clicked()), this, SLOT(slotNewButton())); 124 connect(newButton, SIGNAL(clicked()), this, SLOT(slotNewButton()));
125 connect(deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButton()));
120 populateBox(); 126 populateBox();
121 load(); 127 load();
@@ -125,6 +131,9 @@ NotesControl::NotesControl( QWidget *parent, const char *name )
125 131
126void NotesControl::slotDeleteButton() { 132void NotesControl::slotDeleteButton() {
133
127 QString selectedText = box->currentText(); 134 QString selectedText = box->currentText();
128 qDebug("deleting "+selectedText); 135 qDebug("deleting "+selectedText);
136
137 if( !selectedText.isEmpty()) {
129 Config cfg("Notes"); 138 Config cfg("Notes");
130 cfg.setGroup("Docs"); 139 cfg.setGroup("Docs");
@@ -152,4 +161,5 @@ void NotesControl::slotDeleteButton() {
152 } 161 }
153 populateBox(); 162 populateBox();
163 }
154} 164}
155 165
@@ -248,11 +258,12 @@ void NotesControl::save() {
248 oldDocName=docname; 258 oldDocName=docname;
249 edited=false; 259 edited=false;
260 qDebug("save");
261 if (doPopulate)
262 populateBox();
250 } 263 }
251 qDebug("save");
252 if (doPopulate)
253 populateBox();
254 }
255 cfg.writeEntry( "LastDoc",oldDocName ); 264 cfg.writeEntry( "LastDoc",oldDocName );
256 cfg.write(); 265 cfg.write();
266
267 }
257} 268}
258 269
@@ -276,7 +287,7 @@ void NotesControl::populateBox() {
276void NotesControl::load() { 287void NotesControl::load() {
277 288
278 Config cfg("Notes");
279 cfg.setGroup("Docs");
280 if(!loaded) { 289 if(!loaded) {
290 Config cfg("Notes");
291 cfg.setGroup("Docs");
281 QString lastDoc=cfg.readEntry( "LastDoc",""); 292 QString lastDoc=cfg.readEntry( "LastDoc","");
282 DocLnk nf; 293 DocLnk nf;
@@ -287,7 +298,7 @@ void NotesControl::load() {
287 loaded=true; 298 loaded=true;
288 oldDocName=lastDoc; 299 oldDocName=lastDoc;
289 } 300 cfg.writeEntry( "LastDoc",oldDocName );
290 cfg.writeEntry( "LastDoc",oldDocName ); 301 cfg.write();
291 cfg.write(); 302 }
292} 303}
293 304
@@ -350,4 +361,5 @@ void NotesApplet::mousePressEvent( QMouseEvent *) {
350 vc->populateBox(); 361 vc->populateBox();
351 vc->doPopulate=false; 362 vc->doPopulate=false;
363 vc->loaded=false;
352 364
353 vc->load(); 365 vc->load();