author | drw <drw> | 2005-05-24 22:29:46 (UTC) |
---|---|---|
committer | drw <drw> | 2005-05-24 22:29:46 (UTC) |
commit | 3a7dd5b0904cdea71d486ffdea8bfd1aedb0af59 (patch) (side-by-side diff) | |
tree | 2573d5c8bdad9d95eede843615a5baa1a45bbc95 | |
parent | a2542a161d15feface21954afcd26f9ec51f131f (diff) | |
download | opie-3a7dd5b0904cdea71d486ffdea8bfd1aedb0af59.zip opie-3a7dd5b0904cdea71d486ffdea8bfd1aedb0af59.tar.gz opie-3a7dd5b0904cdea71d486ffdea8bfd1aedb0af59.tar.bz2 |
Resource -> OResource
-rw-r--r-- | noncore/applets/autorotateapplet/autorotate.cpp | 6 | ||||
-rw-r--r-- | noncore/applets/networkapplet/networkapplet.cpp | 54 | ||||
-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 4 | ||||
-rw-r--r-- | noncore/applets/pyquicklaunch/pyquicklaunch.cpp | 6 | ||||
-rw-r--r-- | noncore/applets/zkbapplet/applet/zkbwidget.cpp | 8 |
5 files changed, 39 insertions, 39 deletions
diff --git a/noncore/applets/autorotateapplet/autorotate.cpp b/noncore/applets/autorotateapplet/autorotate.cpp index 34802fb..28b631b 100644 --- a/noncore/applets/autorotateapplet/autorotate.cpp +++ b/noncore/applets/autorotateapplet/autorotate.cpp @@ -1,97 +1,97 @@ /* * copyright : (c) 2003 by Greg Gilbert * email : greg@treke.net * based on the cardmon applet by Max Reiss * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * *************************************************************************/ #include "autorotate.h" /* OPIE */ #include <opie2/odebug.h> #include <opie2/otaskbarapplet.h> +#include <opie2/oresource.h> #include <qpe/applnk.h> #include <qpe/config.h> -#include <qpe/resource.h> using namespace Opie::Core; /* QT */ #include <qpainter.h> AutoRotate::AutoRotate(QWidget * parent):QWidget(parent) { setFixedWidth( AppLnk::smallIconSize() ); setFixedHeight( AppLnk::smallIconSize() ); - enabledPm.convertFromImage( Resource::loadImage("autorotate/rotate").smoothScale( height(), width() ) ); - disabledPm.convertFromImage( Resource::loadImage("autorotate/norotate").smoothScale( height(), width() ) ); + enabledPm = Opie::Core::OResource::loadImage("autorotate/rotate", Opie::Core::OResource::SmallIcon); + disabledPm = Opie::Core::OResource::loadImage("autorotate/norotate", Opie::Core::OResource::SmallIcon); repaint(true); popupMenu = 0; show(); } AutoRotate::~AutoRotate() { if (popupMenu) { delete popupMenu; } } int AutoRotate::position() { return 7; } void AutoRotate::mousePressEvent(QMouseEvent *) { QPopupMenu *menu = new QPopupMenu(this); menu->insertItem( isRotateEnabled()? "Disable Rotation" : "Enable Rotation" ,1 ); QPoint p = mapToGlobal(QPoint(0, 0)); QSize s = menu->sizeHint(); int opt = menu->exec(QPoint(p.x() + (width() / 2) - (s.width() / 2), p.y() - s.height()), 0); if (opt==1) { setRotateEnabled( !isRotateEnabled() ); repaint(true); } delete menu; } void AutoRotate::paintEvent(QPaintEvent *) { QPainter p(this); p.drawPixmap( 0, 0, isRotateEnabled()? enabledPm : disabledPm ); } void AutoRotate::setRotateEnabled(bool status) { Config cfg( "qpe" ); cfg.setGroup( "Appearance" ); cfg.writeEntry( "rotateEnabled", status ); } bool AutoRotate::isRotateEnabled() { Config cfg( "qpe" ); cfg.setGroup( "Appearance" ); bool res = cfg.readBoolEntry( "rotateEnabled" ); if (res ) odebug << "Enabled" << oendl; else odebug << "Disabled" << oendl; return res; } EXPORT_OPIE_APPLET_v1( AutoRotate ) diff --git a/noncore/applets/networkapplet/networkapplet.cpp b/noncore/applets/networkapplet/networkapplet.cpp index bd6ca66..10c2b34 100644 --- a/noncore/applets/networkapplet/networkapplet.cpp +++ b/noncore/applets/networkapplet/networkapplet.cpp @@ -1,255 +1,255 @@ /* - This file is part of the Opie Project + This file is part of the Opie Project =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> .=l. - .>+-= - _;:, .> :=|. This program is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU Library General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This program is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU -..}^=.= = ; Library General Public License for more -++= -. .` .: details. - : = ...= . :.=- - -. .:....=;==+<; You should have received a copy of the GNU - -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. + .>+-= +_;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. +: = ...= . :.=- +-. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "networkapplet.h" /* OPIE */ #include <opie2/odebug.h> #include <opie2/onetwork.h> +#include <opie2/oresource.h> #include <opie2/otaskbarapplet.h> #include <qpe/applnk.h> -#include <qpe/resource.h> +#include <qpe/qpeapplication.h> using namespace Opie::Core; using namespace Opie::Ui; using namespace Opie::Net; /* QT */ #include <qpainter.h> #include <qlabel.h> #include <qlayout.h> #include <qobjectlist.h> /* STD */ #include <assert.h> IfaceUpDownButton::IfaceUpDownButton( QWidget* parent, const char* name ) :QToolButton( parent, name ) { _iface = ONetwork::instance()->interface( name ); assert( _iface ); setToggleButton( true ); - //setAutoRaise( true ); - setOnIconSet( QIconSet( Resource::loadPixmap( "up" ) ) ); - setOffIconSet( QIconSet( Resource::loadPixmap( "down" ) ) ); + setUsesBigPixmap( qApp->desktop()->size().width() > 330 ); + setOnIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) ) ); + setOffIconSet( QIconSet( Opie::Core::OResource::loadPixmap( "down", Opie::Core::OResource::SmallIcon ) ) ); setOn( _iface->isUp() ); - //setFixedWidth( 16 ); connect( this, SIGNAL( clicked() ), this, SLOT( clicked() ) ); } IfaceUpDownButton::~IfaceUpDownButton() { } void IfaceUpDownButton::clicked() { _iface->setUp( isOn() ); setOn( _iface->isUp() ); // it might not have worked... repaint(); } IfaceIPAddress::IfaceIPAddress( QWidget* parent, const char* name ) :QLineEdit( parent, name ) { setFont( QFont( "fixed" ) ); _iface = ONetwork::instance()->interface( name ); setFixedWidth( 105 ); setText( _iface->ipV4Address().toString() ); connect( this, SIGNAL( returnPressed() ), this, SLOT( returnPressed() ) ); } IfaceIPAddress::~IfaceIPAddress() { } void IfaceIPAddress::returnPressed() { QHostAddress a; a.setAddress( text() ); QHostAddress mask; mask.setAddress( _iface->ipV4Netmask().toString() ); // setIPV4Address destroys the netmask... _iface->setIPV4Address( a ); _iface->setIPV4Netmask( mask ); // recover the old netmask setText( _iface->ipV4Address().toString() ); repaint(); } NetworkAppletControl::NetworkAppletControl( OTaskbarApplet* parent, const char* name ) :QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), l(0) { setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); l = new QVBoxLayout( this, 4, 2 ); } void NetworkAppletControl::build() { ONetwork::InterfaceIterator it = ONetwork::instance()->iterator(); while ( it.current() ) { QHBoxLayout* h = new QHBoxLayout( l ); QLabel* symbol = new QLabel( this ); - symbol->setPixmap( Resource::loadPixmap( guessDevice( it.current() ) ) ); + symbol->setPixmap( Opie::Core::OResource::loadPixmap( guessDevice( it.current() ), Opie::Core::OResource::SmallIcon ) ); h->addWidget( symbol ); symbol->show(); QLabel* name = new QLabel( it.current()->name(), this ); name->setFixedWidth( 35 ); h->addWidget( name ); name->show(); IfaceIPAddress* ip = new IfaceIPAddress( this, it.current()->name() ); h->addWidget( ip ); ip->show(); IfaceUpDownButton* tb = new IfaceUpDownButton( this, it.current()->name() ); tb->show(); h->addWidget( tb ); ++it; } } NetworkAppletControl::~NetworkAppletControl() { } QString NetworkAppletControl::guessDevice( ONetworkInterface* iface ) { if ( iface->isWireless() ) return "networksettings/wlan"; if ( iface->isLoopback() ) return "networksettings/lo"; if ( QString( iface->name() ).contains( "usb" ) ) return "networksettings/usb"; if ( QString( iface->name() ).contains( "ir" ) ) return "networksettings/irda"; //TODO: Insert neat symbol and check for tunnel devices return "networksettings/lan"; } void NetworkAppletControl::showEvent( QShowEvent* e ) { odebug << "showEvent" << oendl; build(); QWidget::showEvent( e ); } void NetworkAppletControl::hideEvent( QHideEvent* e ) { odebug << "hideEvent" << oendl; QWidget::hideEvent( e ); delete l; // delete all child widgets from this frame QObjectList* list = const_cast<QObjectList*>( children() ); QObjectListIt it(*list); QObject* obj; while ( (obj=it.current()) ) { ++it; delete obj; } list = const_cast<QObjectList*>( children() ); if ( list ) owarn << "D'oh! We still have " << list->count() << " children..." << oendl; // renew layout l = new QVBoxLayout( this, 4, 2 ); resize( 0, 0 ); } QSize NetworkAppletControl::sizeHint() const { ONetwork::instance()->synchronize(); // rebuild interface database odebug << "sizeHint (#ifaces=" << ONetwork::instance()->count() << ")" << oendl; return QSize( 14+35+105+14 + 8, ONetwork::instance()->count() * 26 ); } NetworkApplet::NetworkApplet( QWidget *parent, const char *name ) :OTaskbarApplet( parent, name ) { setFixedHeight( AppLnk::smallIconSize() ); setFixedWidth( AppLnk::smallIconSize() ); - _pixmap.convertFromImage( Resource::loadImage( "networkapplet/network" ).smoothScale( height(), width() ) ); + _pixmap = Opie::Core::OResource::loadPixmap( "networkapplet/network", Opie::Core::OResource::SmallIcon ); _control = new NetworkAppletControl( this, "control" ); } NetworkApplet::~NetworkApplet() { } int NetworkApplet::position() { return 4; } void NetworkApplet::paintEvent( QPaintEvent* ) { QPainter p(this); p.drawPixmap(0, 2, _pixmap ); } void NetworkApplet::mousePressEvent( QMouseEvent* ) { if ( !_control->isVisible() ) { popup( _control ); } else { _control->hide(); } } EXPORT_OPIE_APPLET_v1( NetworkApplet ) diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index d06672a..13f297e 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp @@ -1,219 +1,219 @@ /********************************************************************** ** Copyright (C) 2002 L.J. Potter <llornkcor@handhelds.org> ** 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 <opie2/oresource.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> 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"); box = new QListBox(vbox, "OpieNotesBox"); QPEApplication::setStylusOperation( box->viewport(),QPEApplication::RightOnHold); box->setFixedHeight(50); vbox->setMargin( 6 ); vbox->setSpacing( 3 ); setFocusPolicy(QWidget::StrongFocus); newButton= new QPushButton( hbox, "newButton" ); newButton->setText(tr("New")); saveButton= new QPushButton( hbox, "saveButton" ); saveButton->setText(tr("Save")); deleteButton= new QPushButton( hbox, "deleteButton" ); deleteButton->setText(tr("Delete")); connect( box, SIGNAL( mouseButtonPressed(int,QListBoxItem*,const QPoint&)), this,SLOT( boxPressed(int,QListBoxItem*,const QPoint&)) ); connect(box, SIGNAL(highlighted(const QString&)), this, SLOT(slotBoxSelected(const QString&))); connect( &menuTimer, SIGNAL( timeout() ), SLOT( showMenu() ) ); connect(view,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) ); connect(newButton, SIGNAL(clicked()), this, SLOT(slotNewButton())); connect(saveButton, SIGNAL(clicked()), this, SLOT(slotSaveButton())); connect(deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButtonClicked())); populateBox(); load(); setCaption("Notes"); // parent->setFocus(); } void NotesControl::slotSaveButton() { slotNewButton(); populateBox(); } void NotesControl::slotDeleteButtonClicked() { switch ( QMessageBox::warning(this,tr("Delete?") ,tr("Do you really want to<BR><B> delete</B> this note ?") ,tr("Yes"),tr("No"),0,1,1) ) { case 0: slotDeleteButton(); break; }; } void NotesControl::slotDeleteButton() { QString selectedText = box->currentText(); odebug << "deleting "+selectedText << oendl; if( !selectedText.isEmpty()) { Config cfg("Notes"); cfg.setGroup("Docs"); int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); QString entryName, entryName2;; for ( int i = 0; i < noOfFiles; i++ ) { entryName.sprintf( "File%i", i + 1 ); if(selectedText == cfg.readEntry( entryName )) { 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; cfg.writeEntry(entryName, temp); i++; } cfg.writeEntry("NumberOfFiles", noOfFiles-1 ); entryName.sprintf( "File%i", noOfFiles ); cfg.removeEntry(entryName); cfg.write(); DocLnk nf(selectedText); nf.removeFiles(); QString fi=QPEApplication::documentDir()+"/text/plain/"+selectedText+".desktop"; odebug << fi << oendl; QFile f( fi); if( !f.remove()) odebug << ".desktop file not removed" << oendl; } } view->clear(); populateBox(); } } void NotesControl::slotNewButton() { if(edited) save(); view->clear(); view->setFocus(); edited=false; isNew=false; } void NotesControl::slotBeamButton() { Ir ir; if(!ir.supported()){ } else { this->hide(); QString selectedText = box->currentText(); if( !selectedText.isEmpty()) { QString file = QDir::homeDirPath()+"/"+selectedText; QFile f(file); Ir *irFile = new Ir(this, "IR"); connect( irFile, SIGNAL(done(Ir*)), this, SLOT( slotBeamFinished(Ir*))); irFile->send( file, "Note", "text/plain" ); } } } void NotesControl::slotBeamFinished(Ir *) { this->show(); } void NotesControl::boxPressed(int mouse, QListBoxItem *, const QPoint&) { switch (mouse) { case 1:{ } break; case 2: menuTimer.start( 500, TRUE ); break; }; } void NotesControl::slotBoxSelected(const QString &itemString) { if(edited) { @@ -243,244 +243,244 @@ void NotesControl::focusOutEvent ( QFocusEvent * e) { save(); else { if(!loaded) { populateBox(); load(); } } QWidget::focusOutEvent(e); } void NotesControl::save() { Config cfg("Notes"); cfg.setGroup("Docs"); if( edited) { // odebug << "is edited" << oendl; QString rt = view->text(); if( rt.length()>1) { QString pt = rt.simplifyWhiteSpace(); int i = pt.find( ' ', pt.find( ' ' )+2 ); QString docname = pt; if ( i > 0 ) docname = pt.left(i); // remove "." at the beginning while( docname.startsWith( "." ) ) docname = docname.mid( 1 ); docname.replace( QRegExp("/"), "_" ); // cut the length. filenames longer than that don't make sense // and something goes wrong when they get too long. if ( docname.length() > 40 ) docname = docname.left(40); if ( docname.isEmpty() ) docname = "Empty Text"; // odebug << docname << oendl; if( oldDocName != docname) { int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); QString entryName; entryName.sprintf( "File%i", noOfFiles + 1 ); cfg.writeEntry( entryName,docname ); cfg.writeEntry("NumberOfFiles", noOfFiles+1 ); cfg.write(); } // else // odebug << "oldname equals docname" << oendl; doc = new DocLnk(docname); if(QFile(doc->linkFile()).exists()) odebug << "puppie" << oendl; doc->setType("text/plain"); doc->setName(docname); QString temp = docname.replace( QRegExp(" "), "_" ); doc->setFile( QDir::homeDirPath()+"/notes/"+temp); FileManager fm; if ( !fm.saveFile( *doc, rt ) ) { } oldDocName=docname; edited=false; // odebug << "save" << oendl; if (doPopulate) populateBox(); } cfg.writeEntry( "LastDoc",oldDocName ); cfg.write(); } } void NotesControl::populateBox() { box->clear(); // odebug << "populate" << oendl; Config cfg("Notes"); cfg.setGroup("Docs"); int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); QStringList list; QString entryName; for ( int i = 0; i < noOfFiles; i++ ) { entryName.sprintf( "File%i", i + 1 ); list.append(cfg.readEntry( entryName )); } list.sort(); box->insertStringList(list,-1); doPopulate=false; update(); } void NotesControl::load() { if(!loaded) { Config cfg("Notes"); cfg.setGroup("Docs"); QString lastDoc=cfg.readEntry( "LastDoc","notes"); DocLnk nf; nf.setType("text/plain"); nf.setFile(lastDoc); loadDoc(nf); loaded=true; oldDocName=lastDoc; cfg.writeEntry( "LastDoc",oldDocName ); cfg.write(); } } void NotesControl::load(const QString & file) { odebug << "loading "+file << oendl; QString name = file; QString temp; if( !QFile( QDir::homeDirPath()+"/"+file).exists() ) temp = QDir::homeDirPath()+"/notes/"+ name.replace( QRegExp(" "), "_" ); else temp = name; if(!loaded) { DocLnk nf; nf.setType("text/plain"); nf.setFile( temp); if(!temp.isEmpty()) loadDoc(nf); loaded=true; } // view->setFocus(); oldDocName=file; Config cfg("Notes"); cfg.setGroup("Docs"); cfg.writeEntry( "LastDoc",oldDocName ); cfg.write(); } void NotesControl::loadDoc( const DocLnk &f) { FileManager fm; QString txt; if ( !fm.loadFile( f, txt ) ) { odebug << "could not load file "+f.file() << oendl; return; } view->setText(txt); } void NotesControl::slotViewEdited() { if(loaded) { edited=true; } } void NotesControl::slotShowMax() { Config cfg("Notes"); cfg.setGroup("Options"); showMax=!showMax; cfg.writeEntry("ShowMax", showMax); cfg.write(); hide(); } void NotesControl::slotSearch() { int boxCount = box->count(); for(int i=0;i< boxCount;i++) { } } // void NotesControl::keyReleaseEvent( QKeyEvent *e) { // switch ( e->state() ) { // case ControlButton: // if(e->key() == Key_C) { //copy // 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( AppLnk::smallIconSize() ); setFixedWidth( AppLnk::smallIconSize() ); - notesPixmap.convertFromImage( Resource::loadImage( "edit" ).smoothScale( height(), width() ) ); + notesPixmap = Opie::Core::OResource::loadImage( "edit", Opie::Core::OResource::SmallIcon ); 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, 2, notesPixmap ); } EXPORT_OPIE_APPLET_v1( NotesApplet ) diff --git a/noncore/applets/pyquicklaunch/pyquicklaunch.cpp b/noncore/applets/pyquicklaunch/pyquicklaunch.cpp index bcd2f0d..45eda4e 100644 --- a/noncore/applets/pyquicklaunch/pyquicklaunch.cpp +++ b/noncore/applets/pyquicklaunch/pyquicklaunch.cpp @@ -1,155 +1,155 @@ /********************************************************************** ** Copyright (C) 2004 Michael 'Mickey' Lauer <mickey@vanille.de> ** 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 "pyquicklaunch.h" /* OPIE */ #include <opie2/odebug.h> +#include <opie2/oresource.h> #include <opie2/otaskbarapplet.h> #include <qpe/config.h> #include <qpe/qpeapplication.h> -#include <qpe/resource.h> using namespace Opie::Core; /* QT */ #include <qcopchannel_qws.h> #include <qpainter.h> #include <qframe.h> #include <qfile.h> #include <qtimer.h> /* STD */ #include <pwd.h> #include <sys/types.h> #include <unistd.h> PyQuicklaunchControl::PyQuicklaunchControl( PyQuicklaunchApplet *applet, QWidget *parent, const char *name ) : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) { setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); setFixedSize( sizeHint() ); setFocusPolicy( QWidget::NoFocus ); } void PyQuicklaunchControl::show( bool ) { QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) ); int w = sizeHint().width(); int x = curPos.x() - ( w / 2 ); if ( ( x + w ) > QPEApplication::desktop() ->width() ) x = QPEApplication::desktop ( ) -> width ( ) - w; move( x, curPos.y () - sizeHint().height () ); QFrame::show(); } void PyQuicklaunchControl::readConfig() { Config cfg( "qpe" ); cfg.setGroup( "PyQuicklaunch" ); // ... } void PyQuicklaunchControl::writeConfigEntry( const char *entry, int val ) { Config cfg( "qpe" ); cfg.setGroup( "PyQuicklaunch" ); cfg.writeEntry( entry, val ); } //=========================================================================== PyQuicklaunchApplet::PyQuicklaunchApplet( QWidget *parent, const char *name ) : QWidget( parent, name ), online( false ) { setFixedHeight( 18 ); setFixedWidth( 14 ); status = new PyQuicklaunchControl( this, this, "Python Quicklaunch Status" ); - _online = Resource::loadPixmap( "pyquicklaunch/online" ); - _offline = Resource::loadPixmap( "pyquicklaunch/offline" ); + _online = Opie::Core::OResource::loadPixmap( "pyquicklaunch/online", Opie::Core::OResource::SmallIcon ); + _offline = Opie::Core::OResource::loadPixmap( "pyquicklaunch/offline", Opie::Core::OResource::SmallIcon ); _fifoName = QString().sprintf( "/tmp/mickeys-quicklauncher-%s", ::getpwuid( ::getuid() )->pw_name ); odebug << "PyQuicklaunchApplet fifo name = '" << _fifoName << "'" << oendl; _fifo.setName( _fifoName ); _control = new QCopChannel( "QPE/PyLauncher", parent, "PyLauncher QCop Control Channel" ); connect( _control, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(receivedMessage(const QCString&,const QByteArray&) ) ); } PyQuicklaunchApplet::~PyQuicklaunchApplet() { } void PyQuicklaunchApplet::receivedMessage( const QCString& msg, const QByteArray& data ) { odebug << "receivedMessage = '" << msg << "' " << oendl; if ( msg == "setOnline()" ) { online = true; repaint( true ); } else if ( msg == "setOffline()" ) { online = false; repaint( true ); } else { odebug << "unknown command." << oendl; } } void PyQuicklaunchApplet::timerEvent( QTimerEvent* ) { bool nowOnline = _fifo.exists(); if ( nowOnline != online ) { online = nowOnline; repaint( true ); } } void PyQuicklaunchApplet::mousePressEvent( QMouseEvent * ) { status->isVisible() ? status->hide() : status->show( true ); } void PyQuicklaunchApplet::paintEvent( QPaintEvent* ) { QPainter p( this ); p.drawPixmap( 0, 2, online ? _online : _offline ); } int PyQuicklaunchApplet::position() { return 6; } EXPORT_OPIE_APPLET_v1( PyQuicklaunchApplet ) diff --git a/noncore/applets/zkbapplet/applet/zkbwidget.cpp b/noncore/applets/zkbapplet/applet/zkbwidget.cpp index 55c08b3..324ccdc 100644 --- a/noncore/applets/zkbapplet/applet/zkbwidget.cpp +++ b/noncore/applets/zkbapplet/applet/zkbwidget.cpp @@ -1,160 +1,160 @@ #include <opie2/otaskbarapplet.h> #include <opie2/okeyfilter.h> +#include <opie2/oresource.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/applnk.h> #include <qpe/qpeapplication.h> -#include <qpe/resource.h> -#include <stdio.h> -#include <unistd.h> +//#include <stdio.h> +//#include <unistd.h> #include "zkbwidget.h" #include "zkbcfg.h" using namespace Opie::Ui; ZkbWidget::ZkbWidget(QWidget* parent) - :QLabel(parent),keymap(0),disabled(Resource::loadPixmap("zkb-disabled")) { + :QLabel(parent),keymap(0),disabled(Opie::Core::OResource::loadPixmap("zkb-disabled", Opie::Core::OResource::SmallIcon)) { labels = new QPopupMenu(); connect(labels, SIGNAL(activated(int)), this, SLOT(labelChanged(int))); loadKeymap(); channel = new QCopChannel("QPE/zkb", this); connect(channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT(signalReceived(const QCString&,const QByteArray&))); setFixedWidth ( AppLnk::smallIconSize() ); setFixedHeight ( AppLnk::smallIconSize() ); } ZkbWidget::~ZkbWidget() { delete keymap; keymap = 0; } int ZkbWidget::position() { return 8; } bool ZkbWidget::loadKeymap() { ZkbConfig c(Global::applicationFileName("zkb", QString::null) ); QFontMetrics fm(font()); delete keymap; keymap = 0; Keymap* km = new Keymap(); if (!c.load("zkb.xml", *km, "")) { delete km; setPixmap(disabled); return false; } connect(km, SIGNAL(stateChanged(const QString&)), this, SLOT(stateChanged(const QString&))); Opie::Core::OKeyFilter::inst()->addHandler(km); Keymap* oldkm = keymap; keymap = km; if (oldkm != 0) { delete oldkm; } QString ltext = keymap->getCurrentLabel(); if (ltext.length()==0) ltext = "??"; setText(ltext); labels->clear(); QStringList l = keymap->listLabels(); labels->insertItem(disabled, 0, 0); int n = 1; w = 0; for(QStringList::Iterator it = l.begin(); it != l.end(); ++it, n++) { // printf("label: %s\n", (const char*) (*it).utf8()); labels->insertItem(*it, n, n); int lw = fm.width(*it); if (lw > w) { w = lw; } } if (w == 0) { hide(); } else { show(); } return true; } void ZkbWidget::stateChanged(const QString& s) { // odebug << "stateChanged: " << s.utf8() << "\n" << oendl; setText(s); } void ZkbWidget::labelChanged(int id) { if (id == 0) { keymap->disable(); setPixmap(disabled); return; } keymap->enable(); QStringList l = keymap->listLabels(); QString lbl = l[id-1]; // printf("labelChanged: %s\n", (const char*) lbl.utf8()); State* state = keymap->getStateByLabel(lbl); if (state != 0) { keymap->setCurrentState(state); setText(lbl); } } void ZkbWidget::mouseReleaseEvent(QMouseEvent*) { QSize sh = labels->sizeHint(); QPoint p = mapToGlobal(QPoint((width()-sh.width())/2,-sh.height())); labels->exec(p); } void ZkbWidget::signalReceived(const QCString& msg, const QByteArray& data) { QDataStream stream(data, IO_ReadOnly); if (msg == "enable()") { keymap->enable(); } else if (msg == "disable()") { keymap->disable(); } else if (msg == "reload()") { QCopEnvelope("QPE/System", "busy()"); QTimer::singleShot(0, this, SLOT(reload())); } else if (msg == "switch(QString)") { QString lbl; stream >> lbl; if (keymap != 0) { State* state = keymap->getStateByLabel(lbl); if (state != 0) { keymap->setCurrentState(state); setText(lbl); } } } else if (msg == "debug(QString)") { QString flag; stream >> flag; } } void ZkbWidget::reload() { loadKeymap(); QCopEnvelope("QPE/System", "notBusy()"); } EXPORT_OPIE_APPLET_v1( ZkbWidget ) |