summaryrefslogtreecommitdiff
authordrw <drw>2005-03-08 21:50:02 (UTC)
committer drw <drw>2005-03-08 21:50:02 (UTC)
commit2b32d3e15f5774ee8f73977d606675e819498614 (patch) (unidiff)
treee30982f7bfdf36bb8bfc2e3762c2d9234b809607
parentd32769dbeedb21fd7bdafb1c762e4e501cb02961 (diff)
downloadopie-2b32d3e15f5774ee8f73977d606675e819498614.zip
opie-2b32d3e15f5774ee8f73977d606675e819498614.tar.gz
opie-2b32d3e15f5774ee8f73977d606675e819498614.tar.bz2
Better version of icon
Diffstat (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
@@ -25,4 +25,5 @@
25#include <qpe/ir.h> 25#include <qpe/ir.h>
26#include <qpe/config.h> 26#include <qpe/config.h>
27#include <qpe/resource.h>
27using namespace Opie::Core; 28using namespace Opie::Core;
28using namespace Opie::Ui; 29using namespace Opie::Ui;
@@ -49,36 +50,4 @@ using namespace Opie::Ui;
49#include <stdlib.h> 50#include <stdlib.h>
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 * )
84 : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop ) 53 : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop )
@@ -87,7 +56,7 @@ NotesControl::NotesControl( QWidget *, const char * )
87 QDir d( QDir::homeDirPath()+"/notes"); 56 QDir d( QDir::homeDirPath()+"/notes");
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 }
93 Config cfg("Notes"); 62 Config cfg("Notes");
@@ -168,5 +137,5 @@ void NotesControl::slotDeleteButton() {
168 137
169 QString selectedText = box->currentText(); 138 QString selectedText = box->currentText();
170 odebug << "deleting "+selectedText << oendl; 139 odebug << "deleting "+selectedText << oendl;
171 140
172 if( !selectedText.isEmpty()) { 141 if( !selectedText.isEmpty()) {
@@ -179,10 +148,10 @@ void NotesControl::slotDeleteButton() {
179 entryName.sprintf( "File%i", i + 1 ); 148 entryName.sprintf( "File%i", i + 1 );
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++ ) {
183 entryName.sprintf( "File%i", i + 1 ); 152 entryName.sprintf( "File%i", i + 1 );
184 entryName2.sprintf( "File%i", i + 2 ); 153 entryName2.sprintf( "File%i", i + 2 );
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);
188 i++; 157 i++;
@@ -195,8 +164,8 @@ void NotesControl::slotDeleteButton() {
195 nf.removeFiles(); 164 nf.removeFiles();
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
202 } 171 }
@@ -286,5 +255,5 @@ void NotesControl::save() {
286 cfg.setGroup("Docs"); 255 cfg.setGroup("Docs");
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();
290 if( rt.length()>1) { 259 if( rt.length()>1) {
@@ -304,5 +273,5 @@ void NotesControl::save() {
304 if ( docname.isEmpty() ) 273 if ( docname.isEmpty() )
305 docname = "Empty Text"; 274 docname = "Empty Text";
306// odebug << docname << oendl; 275// odebug << docname << oendl;
307 276
308 if( oldDocName != docname) { 277 if( oldDocName != docname) {
@@ -315,9 +284,9 @@ void NotesControl::save() {
315 } 284 }
316// else 285// else
317// odebug << "oldname equals docname" << oendl; 286// odebug << "oldname equals docname" << oendl;
318 287
319 doc = new DocLnk(docname); 288 doc = new DocLnk(docname);
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");
323 doc->setName(docname); 292 doc->setName(docname);
@@ -330,5 +299,5 @@ void NotesControl::save() {
330 oldDocName=docname; 299 oldDocName=docname;
331 edited=false; 300 edited=false;
332// odebug << "save" << oendl; 301// odebug << "save" << oendl;
333 if (doPopulate) 302 if (doPopulate)
334 populateBox(); 303 populateBox();
@@ -342,5 +311,5 @@ void NotesControl::save() {
342void NotesControl::populateBox() { 311void NotesControl::populateBox() {
343 box->clear(); 312 box->clear();
344// odebug << "populate" << oendl; 313// odebug << "populate" << oendl;
345 Config cfg("Notes"); 314 Config cfg("Notes");
346 cfg.setGroup("Docs"); 315 cfg.setGroup("Docs");
@@ -377,5 +346,5 @@ void NotesControl::load() {
377 346
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;
381 QString temp; 350 QString temp;
@@ -404,5 +373,5 @@ void NotesControl::loadDoc( const DocLnk &f) {
404 QString txt; 373 QString txt;
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;
408 } 377 }
@@ -438,5 +407,5 @@ void NotesControl::slotSearch() {
438// case ControlButton: 407// case ControlButton:
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();
442// QString text; 411// QString text;
@@ -462,6 +431,7 @@ void NotesControl::slotSearch() {
462NotesApplet::NotesApplet( QWidget *parent, const char *name ) 431NotesApplet::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;
467} 437}
@@ -485,8 +455,8 @@ void NotesApplet::mousePressEvent( QMouseEvent *) {
485// QPoint curPos = mapToGlobal( rect().topLeft() ); 455// QPoint curPos = mapToGlobal( rect().topLeft() );
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();
492 QRect rect = QApplication::desktop()->geometry(); 462 QRect rect = QApplication::desktop()->geometry();
@@ -509,5 +479,5 @@ void NotesApplet::mousePressEvent( QMouseEvent *) {
509void NotesApplet::paintEvent( QPaintEvent* ) { 479void 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}
513 483