summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/notesapplet/notes.cpp76
1 files changed, 23 insertions, 53 deletions
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp
index b3e72a7..d06672a 100644
--- a/noncore/applets/notesapplet/notes.cpp
+++ b/noncore/applets/notesapplet/notes.cpp
@@ -26,2 +26,3 @@
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/resource.h>
27using namespace Opie::Core; 28using namespace Opie::Core;
@@ -50,34 +51,2 @@ using namespace Opie::Ui;
50 51
51/* XPM */
52static char * notes_xpm[] = {
53"16 16 11 1",
54" c None",
55". c #000000",
56"+ c #7F7F7F",
57"@ c #BFBFBF",
58"# c #BFC1FF",
59"$ c #FF0000",
60"% c #FFFFFF",
61"& c #00037F",
62"* c #0006FF",
63"= c #0005BF",
64"- c #7F0000",
65" .. ",
66" .. ",
67" ... ",
68" .+ ",
69" .@. ",
70" . .+ ",
71" ..#.@. ",
72" ..###.+.. ",
73" ..###$...##.. ",
74"..###$$$%+$$##&.",
75".*=####$-###&=&.",
76".=**=###==&=&=..",
77" ..=**=#&=&=.. ",
78" ..=*=&=.. ",
79" ..=.. ",
80" . "};
81
82
83NotesControl::NotesControl( QWidget *, const char * ) 52NotesControl::NotesControl( QWidget *, const char * )
@@ -88,5 +57,5 @@ NotesControl::NotesControl( QWidget *, const char * )
88 if( !d.exists()) { 57 if( !d.exists()) {
89 odebug << "make dir" << oendl; 58 odebug << "make dir" << oendl;
90 if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) 59 if(!d.mkdir( QDir::homeDirPath()+"/notes", true))
91 odebug << "<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed" << oendl; 60 odebug << "<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed" << oendl;
92 } 61 }
@@ -169,3 +138,3 @@ void NotesControl::slotDeleteButton() {
169 QString selectedText = box->currentText(); 138 QString selectedText = box->currentText();
170 odebug << "deleting "+selectedText << oendl; 139 odebug << "deleting "+selectedText << oendl;
171 140
@@ -180,3 +149,3 @@ void NotesControl::slotDeleteButton() {
180 if(selectedText == cfg.readEntry( entryName )) { 149 if(selectedText == cfg.readEntry( entryName )) {
181 odebug << "removing " << selectedText.latin1() << ", " << i << "" << oendl; 150 odebug << "removing " << selectedText.latin1() << ", " << i << "" << oendl;
182 for ( int j = i; j < noOfFiles; j++ ) { 151 for ( int j = i; j < noOfFiles; j++ ) {
@@ -185,3 +154,3 @@ void NotesControl::slotDeleteButton() {
185 QString temp = cfg.readEntry(entryName2); 154 QString temp = cfg.readEntry(entryName2);
186 odebug << "move "+temp << oendl; 155 odebug << "move "+temp << oendl;
187 cfg.writeEntry(entryName, temp); 156 cfg.writeEntry(entryName, temp);
@@ -196,6 +165,6 @@ void NotesControl::slotDeleteButton() {
196 QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; 165 QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop";
197 odebug << fi << oendl; 166 odebug << fi << oendl;
198 167
199 QFile f( fi); 168 QFile f( fi);
200 if( !f.remove()) odebug << ".desktop file not removed" << oendl; 169 if( !f.remove()) odebug << ".desktop file not removed" << oendl;
201 170
@@ -287,3 +256,3 @@ void NotesControl::save() {
287 if( edited) { 256 if( edited) {
288// odebug << "is edited" << oendl; 257// odebug << "is edited" << oendl;
289 QString rt = view->text(); 258 QString rt = view->text();
@@ -305,3 +274,3 @@ void NotesControl::save() {
305 docname = "Empty Text"; 274 docname = "Empty Text";
306// odebug << docname << oendl; 275// odebug << docname << oendl;
307 276
@@ -316,3 +285,3 @@ void NotesControl::save() {
316// else 285// else
317// odebug << "oldname equals docname" << oendl; 286// odebug << "oldname equals docname" << oendl;
318 287
@@ -320,3 +289,3 @@ void NotesControl::save() {
320 if(QFile(doc->linkFile()).exists()) 289 if(QFile(doc->linkFile()).exists())
321 odebug << "puppie" << oendl; 290 odebug << "puppie" << oendl;
322 doc->setType("text/plain"); 291 doc->setType("text/plain");
@@ -331,3 +300,3 @@ void NotesControl::save() {
331 edited=false; 300 edited=false;
332// odebug << "save" << oendl; 301// odebug << "save" << oendl;
333 if (doPopulate) 302 if (doPopulate)
@@ -343,3 +312,3 @@ void NotesControl::populateBox() {
343 box->clear(); 312 box->clear();
344// odebug << "populate" << oendl; 313// odebug << "populate" << oendl;
345 Config cfg("Notes"); 314 Config cfg("Notes");
@@ -378,3 +347,3 @@ void NotesControl::load() {
378void NotesControl::load(const QString & file) { 347void NotesControl::load(const QString & file) {
379 odebug << "loading "+file << oendl; 348 odebug << "loading "+file << oendl;
380 QString name = file; 349 QString name = file;
@@ -405,3 +374,3 @@ void NotesControl::loadDoc( const DocLnk &f) {
405 if ( !fm.loadFile( f, txt ) ) { 374 if ( !fm.loadFile( f, txt ) ) {
406 odebug << "could not load file "+f.file() << oendl; 375 odebug << "could not load file "+f.file() << oendl;
407 return; 376 return;
@@ -439,3 +408,3 @@ void NotesControl::slotSearch() {
439// if(e->key() == Key_C) { //copy 408// if(e->key() == Key_C) { //copy
440// odebug << "copy" << oendl; 409// odebug << "copy" << oendl;
441// QClipboard *cb = QApplication::clipboard(); 410// QClipboard *cb = QApplication::clipboard();
@@ -463,4 +432,5 @@ NotesApplet::NotesApplet( QWidget *parent, const char *name )
463 : QWidget( parent, name ) { 432 : QWidget( parent, name ) {
464 setFixedHeight( 18 ); 433 setFixedHeight( AppLnk::smallIconSize() );
465 setFixedWidth( 14 ); 434 setFixedWidth( AppLnk::smallIconSize() );
435 notesPixmap.convertFromImage( Resource::loadImage( "edit" ).smoothScale( height(), width() ) );
466 vc = new NotesControl; 436 vc = new NotesControl;
@@ -486,6 +456,6 @@ void NotesApplet::mousePressEvent( QMouseEvent *) {
486 if(vc->showMax) { 456 if(vc->showMax) {
487 odebug << "show max" << oendl; 457 odebug << "show max" << oendl;
488 vc->showMaximized(); 458 vc->showMaximized();
489 } else { 459 } else {
490 odebug << "no show max" << oendl; 460 odebug << "no show max" << oendl;
491 QWidget *wid = QPEApplication::desktop(); 461 QWidget *wid = QPEApplication::desktop();
@@ -510,3 +480,3 @@ void NotesApplet::paintEvent( QPaintEvent* ) {
510 QPainter p(this); 480 QPainter p(this);
511 p.drawPixmap( 0, 1, ( const char** ) notes_xpm ); 481 p.drawPixmap( 0, 2, notesPixmap );
512} 482}