Diffstat (limited to 'noncore/applets/notesapplet/notes.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 13f7cf3..b3e72a7 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp | |||
@@ -16,8 +16,6 @@ | |||
16 | #include "notes.h" | 16 | #include "notes.h" |
17 | 17 | ||
18 | #include <qapplication.h> | 18 | /* OPIE */ |
19 | #include <stdlib.h> | 19 | #include <opie2/odebug.h> |
20 | #include <qstringlist.h> | ||
21 | |||
22 | #include <opie2/otaskbarapplet.h> | 20 | #include <opie2/otaskbarapplet.h> |
23 | #include <qpe/filemanager.h> | 21 | #include <qpe/filemanager.h> |
@@ -27,12 +25,13 @@ | |||
27 | #include <qpe/ir.h> | 25 | #include <qpe/ir.h> |
28 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | using namespace Opie::Core; | ||
28 | using namespace Opie::Ui; | ||
29 | 29 | ||
30 | // #include <qsocket.h> | 30 | /* QT */ |
31 | // #include <qclipboard.h> | ||
32 | #include <qmultilineedit.h> | 31 | #include <qmultilineedit.h> |
33 | #include <qlistbox.h> | 32 | #include <qlistbox.h> |
34 | #include <qpopupmenu.h> | 33 | #include <qpopupmenu.h> |
35 | #include <qmessagebox.h> | 34 | #include <qmessagebox.h> |
36 | 35 | #include <qapplication.h> | |
37 | #include <qdir.h> | 36 | #include <qdir.h> |
38 | #include <qfile.h> | 37 | #include <qfile.h> |
@@ -44,8 +43,11 @@ | |||
44 | #include <qpixmap.h> | 43 | #include <qpixmap.h> |
45 | #include <qstring.h> | 44 | #include <qstring.h> |
45 | #include <qstringlist.h> | ||
46 | #include <qtimer.h> | 46 | #include <qtimer.h> |
47 | 47 | ||
48 | /* STD */ | ||
49 | #include <stdlib.h> | ||
50 | |||
48 | /* XPM */ | 51 | /* XPM */ |
49 | using namespace Opie::Ui; | ||
50 | static char * notes_xpm[] = { | 52 | static char * notes_xpm[] = { |
51 | "16 16 11 1", | 53 | "16 16 11 1", |
@@ -85,7 +87,7 @@ NotesControl::NotesControl( QWidget *, const char * ) | |||
85 | QDir d( QDir::homeDirPath()+"/notes"); | 87 | QDir d( QDir::homeDirPath()+"/notes"); |
86 | if( !d.exists()) { | 88 | if( !d.exists()) { |
87 | qDebug("make dir"); | 89 | odebug << "make dir" << oendl; |
88 | if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) | 90 | if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) |
89 | qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed"); | 91 | odebug << "<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed" << oendl; |
90 | } | 92 | } |
91 | Config cfg("Notes"); | 93 | Config cfg("Notes"); |
@@ -166,5 +168,5 @@ void NotesControl::slotDeleteButton() { | |||
166 | 168 | ||
167 | QString selectedText = box->currentText(); | 169 | QString selectedText = box->currentText(); |
168 | qDebug("deleting "+selectedText); | 170 | odebug << "deleting "+selectedText << oendl; |
169 | 171 | ||
170 | if( !selectedText.isEmpty()) { | 172 | if( !selectedText.isEmpty()) { |
@@ -177,10 +179,10 @@ void NotesControl::slotDeleteButton() { | |||
177 | entryName.sprintf( "File%i", i + 1 ); | 179 | entryName.sprintf( "File%i", i + 1 ); |
178 | if(selectedText == cfg.readEntry( entryName )) { | 180 | if(selectedText == cfg.readEntry( entryName )) { |
179 | qDebug("removing %s, %d", selectedText.latin1(), i); | 181 | odebug << "removing " << selectedText.latin1() << ", " << i << "" << oendl; |
180 | for ( int j = i; j < noOfFiles; j++ ) { | 182 | for ( int j = i; j < noOfFiles; j++ ) { |
181 | entryName.sprintf( "File%i", i + 1 ); | 183 | entryName.sprintf( "File%i", i + 1 ); |
182 | entryName2.sprintf( "File%i", i + 2 ); | 184 | entryName2.sprintf( "File%i", i + 2 ); |
183 | QString temp = cfg.readEntry(entryName2); | 185 | QString temp = cfg.readEntry(entryName2); |
184 | qDebug("move "+temp); | 186 | odebug << "move "+temp << oendl; |
185 | cfg.writeEntry(entryName, temp); | 187 | cfg.writeEntry(entryName, temp); |
186 | i++; | 188 | i++; |
@@ -193,8 +195,8 @@ void NotesControl::slotDeleteButton() { | |||
193 | nf.removeFiles(); | 195 | nf.removeFiles(); |
194 | QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; | 196 | QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; |
195 | qDebug(fi); | 197 | odebug << fi << oendl; |
196 | 198 | ||
197 | QFile f( fi); | 199 | QFile f( fi); |
198 | if( !f.remove()) qDebug(".desktop file not removed"); | 200 | if( !f.remove()) odebug << ".desktop file not removed" << oendl; |
199 | 201 | ||
200 | } | 202 | } |
@@ -284,5 +286,5 @@ void NotesControl::save() { | |||
284 | cfg.setGroup("Docs"); | 286 | cfg.setGroup("Docs"); |
285 | if( edited) { | 287 | if( edited) { |
286 | // qDebug("is edited"); | 288 | // odebug << "is edited" << oendl; |
287 | QString rt = view->text(); | 289 | QString rt = view->text(); |
288 | if( rt.length()>1) { | 290 | if( rt.length()>1) { |
@@ -302,5 +304,5 @@ void NotesControl::save() { | |||
302 | if ( docname.isEmpty() ) | 304 | if ( docname.isEmpty() ) |
303 | docname = "Empty Text"; | 305 | docname = "Empty Text"; |
304 | // qDebug(docname); | 306 | // odebug << docname << oendl; |
305 | 307 | ||
306 | if( oldDocName != docname) { | 308 | if( oldDocName != docname) { |
@@ -313,9 +315,9 @@ void NotesControl::save() { | |||
313 | } | 315 | } |
314 | // else | 316 | // else |
315 | // qDebug("oldname equals docname"); | 317 | // odebug << "oldname equals docname" << oendl; |
316 | 318 | ||
317 | doc = new DocLnk(docname); | 319 | doc = new DocLnk(docname); |
318 | if(QFile(doc->linkFile()).exists()) | 320 | if(QFile(doc->linkFile()).exists()) |
319 | qDebug("puppie"); | 321 | odebug << "puppie" << oendl; |
320 | doc->setType("text/plain"); | 322 | doc->setType("text/plain"); |
321 | doc->setName(docname); | 323 | doc->setName(docname); |
@@ -328,5 +330,5 @@ void NotesControl::save() { | |||
328 | oldDocName=docname; | 330 | oldDocName=docname; |
329 | edited=false; | 331 | edited=false; |
330 | // qDebug("save"); | 332 | // odebug << "save" << oendl; |
331 | if (doPopulate) | 333 | if (doPopulate) |
332 | populateBox(); | 334 | populateBox(); |
@@ -340,5 +342,5 @@ void NotesControl::save() { | |||
340 | void NotesControl::populateBox() { | 342 | void NotesControl::populateBox() { |
341 | box->clear(); | 343 | box->clear(); |
342 | // qDebug("populate"); | 344 | // odebug << "populate" << oendl; |
343 | Config cfg("Notes"); | 345 | Config cfg("Notes"); |
344 | cfg.setGroup("Docs"); | 346 | cfg.setGroup("Docs"); |
@@ -375,5 +377,5 @@ void NotesControl::load() { | |||
375 | 377 | ||
376 | void NotesControl::load(const QString & file) { | 378 | void NotesControl::load(const QString & file) { |
377 | qDebug("loading "+file); | 379 | odebug << "loading "+file << oendl; |
378 | QString name = file; | 380 | QString name = file; |
379 | QString temp; | 381 | QString temp; |
@@ -402,5 +404,5 @@ void NotesControl::loadDoc( const DocLnk &f) { | |||
402 | QString txt; | 404 | QString txt; |
403 | if ( !fm.loadFile( f, txt ) ) { | 405 | if ( !fm.loadFile( f, txt ) ) { |
404 | qDebug("could not load file "+f.file()); | 406 | odebug << "could not load file "+f.file() << oendl; |
405 | return; | 407 | return; |
406 | } | 408 | } |
@@ -436,5 +438,5 @@ void NotesControl::slotSearch() { | |||
436 | // case ControlButton: | 438 | // case ControlButton: |
437 | // if(e->key() == Key_C) { //copy | 439 | // if(e->key() == Key_C) { //copy |
438 | // qDebug("copy"); | 440 | // odebug << "copy" << oendl; |
439 | // QClipboard *cb = QApplication::clipboard(); | 441 | // QClipboard *cb = QApplication::clipboard(); |
440 | // QString text; | 442 | // QString text; |
@@ -483,8 +485,8 @@ void NotesApplet::mousePressEvent( QMouseEvent *) { | |||
483 | // QPoint curPos = mapToGlobal( rect().topLeft() ); | 485 | // QPoint curPos = mapToGlobal( rect().topLeft() ); |
484 | if(vc->showMax) { | 486 | if(vc->showMax) { |
485 | qDebug("show max"); | 487 | odebug << "show max" << oendl; |
486 | vc->showMaximized(); | 488 | vc->showMaximized(); |
487 | } else { | 489 | } else { |
488 | qDebug("no show max"); | 490 | odebug << "no show max" << oendl; |
489 | QWidget *wid = QPEApplication::desktop(); | 491 | QWidget *wid = QPEApplication::desktop(); |
490 | QRect rect = QApplication::desktop()->geometry(); | 492 | QRect rect = QApplication::desktop()->geometry(); |