-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 30 |
1 files changed, 23 insertions, 7 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 @@ -88,4 +88,5 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) edited=false; doPopulate=true; + isNew=false; QVBoxLayout *vbox = new QVBoxLayout( this,0, -1, "Vlayout" ); QHBoxLayout *hbox = new QHBoxLayout( this, 0, -1, "HLayout" ); @@ -188,6 +189,14 @@ void NotesControl::slotDeleteButton() { DocLnk nf(selectedText); nf.removeFiles(); + QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; + qDebug(fi); + + QFile f( fi); + if( !f.remove()) qDebug(".desktop file not removed"); + } } + view->clear(); + populateBox(); } @@ -197,5 +206,7 @@ void NotesControl::slotNewButton() { if(edited) save(); view->clear(); - view->setFocus(); + view->setFocus(); + edited=false; + isNew=false; } @@ -270,6 +281,7 @@ void NotesControl::save() { cfg.setGroup("Docs"); if( edited) { +// qDebug("is edited"); QString rt = view->text(); - if(!rt.isEmpty()) { + if( rt.length()>1) { QString pt = rt.simplifyWhiteSpace(); int i = pt.find( ' ' ); @@ -287,5 +299,5 @@ void NotesControl::save() { if ( docname.isEmpty() ) docname = "Empty Text"; - qDebug(docname); +// qDebug(docname); if( oldDocName != docname) { @@ -297,12 +309,16 @@ void NotesControl::save() { cfg.write(); } - else - qDebug("oldname equals docname"); +// else +// qDebug("oldname equals docname"); + + doc = new DocLnk(docname); + if(QFile(doc->linkFile()).exists()) + qDebug("puppie"); doc->setType("text/plain"); - doc->setFile(docname); + doc->setFile(QDir::homeDirPath()+"/"+docname); doc->setName(docname); - + FileManager fm; if ( !fm.saveFile( *doc, rt ) ) { |