summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
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
@@ -25,4 +25,5 @@
#include <qpe/ir.h>
#include <qpe/config.h>
+#include <qpe/resource.h>
using namespace Opie::Core;
using namespace Opie::Ui;
@@ -49,36 +50,4 @@ using namespace Opie::Ui;
#include <stdlib.h>
-/* XPM */
-static char * notes_xpm[] = {
-"16 16 11 1",
-" c None",
-". c #000000",
-"+ c #7F7F7F",
-"@ c #BFBFBF",
-"# c #BFC1FF",
-"$ c #FF0000",
-"% c #FFFFFF",
-"& c #00037F",
-"* c #0006FF",
-"= c #0005BF",
-"- c #7F0000",
-" .. ",
-" .. ",
-" ... ",
-" .+ ",
-" .@. ",
-" . .+ ",
-" ..#.@. ",
-" ..###.+.. ",
-" ..###$...##.. ",
-"..###$$$%+$$##&.",
-".*=####$-###&=&.",
-".=**=###==&=&=..",
-" ..=**=#&=&=.. ",
-" ..=*=&=.. ",
-" ..=.. ",
-" . "};
-
-
NotesControl::NotesControl( QWidget *, const char * )
: QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop )
@@ -87,7 +56,7 @@ NotesControl::NotesControl( QWidget *, const char * )
QDir d( QDir::homeDirPath()+"/notes");
if( !d.exists()) {
- odebug << "make dir" << oendl;
+ odebug << "make dir" << oendl;
if(!d.mkdir( QDir::homeDirPath()+"/notes", true))
- odebug << "<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed" << oendl;
+ odebug << "<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed" << oendl;
}
Config cfg("Notes");
@@ -168,5 +137,5 @@ void NotesControl::slotDeleteButton() {
QString selectedText = box->currentText();
- odebug << "deleting "+selectedText << oendl;
+ odebug << "deleting "+selectedText << oendl;
if( !selectedText.isEmpty()) {
@@ -179,10 +148,10 @@ void NotesControl::slotDeleteButton() {
entryName.sprintf( "File%i", i + 1 );
if(selectedText == cfg.readEntry( entryName )) {
- odebug << "removing " << selectedText.latin1() << ", " << i << "" << oendl;
+ odebug << "removing " << selectedText.latin1() << ", " << i << "" << oendl;
for ( int j = i; j < noOfFiles; j++ ) {
entryName.sprintf( "File%i", i + 1 );
entryName2.sprintf( "File%i", i + 2 );
QString temp = cfg.readEntry(entryName2);
- odebug << "move "+temp << oendl;
+ odebug << "move "+temp << oendl;
cfg.writeEntry(entryName, temp);
i++;
@@ -195,8 +164,8 @@ void NotesControl::slotDeleteButton() {
nf.removeFiles();
QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop";
- odebug << fi << oendl;
+ odebug << fi << oendl;
QFile f( fi);
- if( !f.remove()) odebug << ".desktop file not removed" << oendl;
+ if( !f.remove()) odebug << ".desktop file not removed" << oendl;
}
@@ -286,5 +255,5 @@ void NotesControl::save() {
cfg.setGroup("Docs");
if( edited) {
-// odebug << "is edited" << oendl;
+// odebug << "is edited" << oendl;
QString rt = view->text();
if( rt.length()>1) {
@@ -304,5 +273,5 @@ void NotesControl::save() {
if ( docname.isEmpty() )
docname = "Empty Text";
-// odebug << docname << oendl;
+// odebug << docname << oendl;
if( oldDocName != docname) {
@@ -315,9 +284,9 @@ void NotesControl::save() {
}
// else
-// odebug << "oldname equals docname" << oendl;
+// odebug << "oldname equals docname" << oendl;
doc = new DocLnk(docname);
if(QFile(doc->linkFile()).exists())
- odebug << "puppie" << oendl;
+ odebug << "puppie" << oendl;
doc->setType("text/plain");
doc->setName(docname);
@@ -330,5 +299,5 @@ void NotesControl::save() {
oldDocName=docname;
edited=false;
-// odebug << "save" << oendl;
+// odebug << "save" << oendl;
if (doPopulate)
populateBox();
@@ -342,5 +311,5 @@ void NotesControl::save() {
void NotesControl::populateBox() {
box->clear();
-// odebug << "populate" << oendl;
+// odebug << "populate" << oendl;
Config cfg("Notes");
cfg.setGroup("Docs");
@@ -377,5 +346,5 @@ void NotesControl::load() {
void NotesControl::load(const QString & file) {
- odebug << "loading "+file << oendl;
+ odebug << "loading "+file << oendl;
QString name = file;
QString temp;
@@ -404,5 +373,5 @@ void NotesControl::loadDoc( const DocLnk &f) {
QString txt;
if ( !fm.loadFile( f, txt ) ) {
- odebug << "could not load file "+f.file() << oendl;
+ odebug << "could not load file "+f.file() << oendl;
return;
}
@@ -438,5 +407,5 @@ void NotesControl::slotSearch() {
// case ControlButton:
// if(e->key() == Key_C) { //copy
-// odebug << "copy" << oendl;
+// odebug << "copy" << oendl;
// QClipboard *cb = QApplication::clipboard();
// QString text;
@@ -462,6 +431,7 @@ void NotesControl::slotSearch() {
NotesApplet::NotesApplet( QWidget *parent, const char *name )
: QWidget( parent, name ) {
- setFixedHeight( 18 );
- setFixedWidth( 14 );
+ setFixedHeight( AppLnk::smallIconSize() );
+ setFixedWidth( AppLnk::smallIconSize() );
+ notesPixmap.convertFromImage( Resource::loadImage( "edit" ).smoothScale( height(), width() ) );
vc = new NotesControl;
}
@@ -485,8 +455,8 @@ void NotesApplet::mousePressEvent( QMouseEvent *) {
// QPoint curPos = mapToGlobal( rect().topLeft() );
if(vc->showMax) {
- odebug << "show max" << oendl;
+ odebug << "show max" << oendl;
vc->showMaximized();
} else {
- odebug << "no show max" << oendl;
+ odebug << "no show max" << oendl;
QWidget *wid = QPEApplication::desktop();
QRect rect = QApplication::desktop()->geometry();
@@ -509,5 +479,5 @@ void NotesApplet::mousePressEvent( QMouseEvent *) {
void NotesApplet::paintEvent( QPaintEvent* ) {
QPainter p(this);
- p.drawPixmap( 0, 1, ( const char** ) notes_xpm );
+ p.drawPixmap( 0, 2, notesPixmap );
}