author | llornkcor <llornkcor> | 2002-10-17 03:47:16 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-17 03:47:16 (UTC) |
commit | 8f6dc7fd4aca312bc615bf4f85755b82d29b250d (patch) (unidiff) | |
tree | 34e9be456b07b7678a3d4b812eec8471317fe641 | |
parent | 11cde43ced1c85ad350cd32ca72b75dcfbce5fce (diff) | |
download | opie-8f6dc7fd4aca312bc615bf4f85755b82d29b250d.zip opie-8f6dc7fd4aca312bc615bf4f85755b82d29b250d.tar.gz opie-8f6dc7fd4aca312bc615bf4f85755b82d29b250d.tar.bz2 |
force removal of desktop file when deleting note
-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 92fdb0a..90c2550 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp | |||
@@ -87,6 +87,7 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) | |||
87 | loaded=false; | 87 | loaded=false; |
88 | edited=false; | 88 | edited=false; |
89 | doPopulate=true; | 89 | doPopulate=true; |
90 | isNew=false; | ||
90 | QVBoxLayout *vbox = new QVBoxLayout( this,0, -1, "Vlayout" ); | 91 | QVBoxLayout *vbox = new QVBoxLayout( this,0, -1, "Vlayout" ); |
91 | QHBoxLayout *hbox = new QHBoxLayout( this, 0, -1, "HLayout" ); | 92 | QHBoxLayout *hbox = new QHBoxLayout( this, 0, -1, "HLayout" ); |
92 | 93 | ||
@@ -187,8 +188,16 @@ void NotesControl::slotDeleteButton() { | |||
187 | cfg.write(); | 188 | cfg.write(); |
188 | DocLnk nf(selectedText); | 189 | DocLnk nf(selectedText); |
189 | nf.removeFiles(); | 190 | nf.removeFiles(); |
191 | QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; | ||
192 | qDebug(fi); | ||
193 | |||
194 | QFile f( fi); | ||
195 | if( !f.remove()) qDebug(".desktop file not removed"); | ||
196 | |||
190 | } | 197 | } |
191 | } | 198 | } |
199 | view->clear(); | ||
200 | |||
192 | populateBox(); | 201 | populateBox(); |
193 | } | 202 | } |
194 | } | 203 | } |
@@ -197,6 +206,8 @@ void NotesControl::slotNewButton() { | |||
197 | if(edited) save(); | 206 | if(edited) save(); |
198 | view->clear(); | 207 | view->clear(); |
199 | view->setFocus(); | 208 | view->setFocus(); |
209 | edited=false; | ||
210 | isNew=false; | ||
200 | } | 211 | } |
201 | 212 | ||
202 | void NotesControl::slotBeamButton() { | 213 | void NotesControl::slotBeamButton() { |
@@ -269,8 +280,9 @@ void NotesControl::save() { | |||
269 | Config cfg("Notes"); | 280 | Config cfg("Notes"); |
270 | cfg.setGroup("Docs"); | 281 | cfg.setGroup("Docs"); |
271 | if( edited) { | 282 | if( edited) { |
283 | // qDebug("is edited"); | ||
272 | QString rt = view->text(); | 284 | QString rt = view->text(); |
273 | if(!rt.isEmpty()) { | 285 | if( rt.length()>1) { |
274 | QString pt = rt.simplifyWhiteSpace(); | 286 | QString pt = rt.simplifyWhiteSpace(); |
275 | int i = pt.find( ' ' ); | 287 | int i = pt.find( ' ' ); |
276 | QString docname = pt; | 288 | QString docname = pt; |
@@ -286,7 +298,7 @@ void NotesControl::save() { | |||
286 | docname = docname.left(40); | 298 | docname = docname.left(40); |
287 | if ( docname.isEmpty() ) | 299 | if ( docname.isEmpty() ) |
288 | docname = "Empty Text"; | 300 | docname = "Empty Text"; |
289 | qDebug(docname); | 301 | // qDebug(docname); |
290 | 302 | ||
291 | if( oldDocName != docname) { | 303 | if( oldDocName != docname) { |
292 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 304 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
@@ -296,12 +308,16 @@ void NotesControl::save() { | |||
296 | cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); | 308 | cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); |
297 | cfg.write(); | 309 | cfg.write(); |
298 | } | 310 | } |
299 | else | 311 | // else |
300 | qDebug("oldname equals docname"); | 312 | // qDebug("oldname equals docname"); |
313 | |||
314 | |||
301 | doc = new DocLnk(docname); | 315 | doc = new DocLnk(docname); |
302 | 316 | ||
317 | if(QFile(doc->linkFile()).exists()) | ||
318 | qDebug("puppie"); | ||
303 | doc->setType("text/plain"); | 319 | doc->setType("text/plain"); |
304 | doc->setFile(docname); | 320 | doc->setFile(QDir::homeDirPath()+"/"+docname); |
305 | doc->setName(docname); | 321 | doc->setName(docname); |
306 | 322 | ||
307 | FileManager fm; | 323 | FileManager fm; |