-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 40 |
1 files changed, 5 insertions, 35 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 @@ -3,104 +3,73 @@ ** All rights reserved. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #include "notes.h" /* OPIE */ #include <opie2/odebug.h> #include <opie2/otaskbarapplet.h> #include <qpe/filemanager.h> #include <qpe/qpeapplication.h> #include <qpe/timestring.h> #include <qpe/applnk.h> #include <qpe/ir.h> #include <qpe/config.h> +#include <qpe/resource.h> using namespace Opie::Core; using namespace Opie::Ui; /* QT */ #include <qmultilineedit.h> #include <qlistbox.h> #include <qpopupmenu.h> #include <qmessagebox.h> #include <qapplication.h> #include <qdir.h> #include <qfile.h> #include <qpoint.h> #include <qpushbutton.h> #include <qpainter.h> #include <qlayout.h> #include <qframe.h> #include <qpixmap.h> #include <qstring.h> #include <qstringlist.h> #include <qtimer.h> /* STD */ #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 ) // : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) { QDir d( QDir::homeDirPath()+"/notes"); if( !d.exists()) { odebug << "make dir" << oendl; if(!d.mkdir( QDir::homeDirPath()+"/notes", true)) odebug << "<<<<<<<<<<<<<<<<<<<<<<<<<<<make dir failed" << oendl; } Config cfg("Notes"); cfg.setGroup("Options"); showMax = cfg.readBoolEntry("ShowMax", false); setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); loaded=false; edited=false; doPopulate=true; isNew=false; QVBox *vbox = new QVBox( this, "Vlayout" ); QHBox *hbox = new QHBox( this, "HLayout" ); view = new QMultiLineEdit(vbox, "OpieNotesView"); @@ -440,77 +409,78 @@ void NotesControl::slotSearch() { // odebug << "copy" << oendl; // QClipboard *cb = QApplication::clipboard(); // QString text; // // Copy text from the clipboard (paste) // text = cb->text(); // } // if(e->key() == Key_X) { //cut // } // if(e->key() == Key_V) { //paste // QClipboard *cb = QApplication::clipboard(); // QString text; // //view // cb->setText(); // } // break; // }; // QWidget::keyReleaseEvent(e); // } //=========================================================================== 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; } NotesApplet::~NotesApplet() { delete vc; } int NotesApplet::position() { return 6; } void NotesApplet::mousePressEvent( QMouseEvent *) { if( !vc->isHidden()) { vc->doPopulate=false; vc->save(); vc->close(); } else { // vc = new NotesControl; // QPoint curPos = mapToGlobal( rect().topLeft() ); if(vc->showMax) { odebug << "show max" << oendl; vc->showMaximized(); } else { odebug << "no show max" << oendl; QWidget *wid = QPEApplication::desktop(); QRect rect = QApplication::desktop()->geometry(); vc->setGeometry( ( wid->width() / 2) - ( vc->width() / 2 ) , 28 , wid->width() -10 , 180); vc->move ( (rect.center()/2) - (vc->rect().center()/2)); // vc->move( (( wid->width() / 2) - ( vc->width() / 2 ))-4, 28); } vc->show(); vc->doPopulate=true; vc->populateBox(); vc->doPopulate=false; vc->loaded=false; vc->load(); // this->setFocus(); vc->view->setFocus(); } } void NotesApplet::paintEvent( QPaintEvent* ) { QPainter p(this); - p.drawPixmap( 0, 1, ( const char** ) notes_xpm ); + p.drawPixmap( 0, 2, notesPixmap ); } EXPORT_OPIE_APPLET_v1( NotesApplet ) |