summaryrefslogtreecommitdiff
authordrw <drw>2005-05-16 20:38:10 (UTC)
committer drw <drw>2005-05-16 20:38:10 (UTC)
commit28503944437feb62c0f2c0a8314385bbca3e9eaf (patch) (side-by-side diff)
tree2b613d2b1bde21bf3e002bb4dc8c474c4d781fe1
parent348314c7411500e23ca467289ed92e446be9121b (diff)
downloadopie-28503944437feb62c0f2c0a8314385bbca3e9eaf.zip
opie-28503944437feb62c0f2c0a8314385bbca3e9eaf.tar.gz
opie-28503944437feb62c0f2c0a8314385bbca3e9eaf.tar.bz2
Resource -> OResource
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp27
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp29
2 files changed, 26 insertions, 30 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 979549d..828f5a1 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -4,56 +4,55 @@
** Created: Sat Mar 9 23:33:09 2002
copyright : (C) 2002 by ljp
email : ljp@llornkcor.com
* 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. *
***************************************************************************/
#define DEVELOPERS_VERSION
#include "advancedfm.h"
#include <opie2/odebug.h>
-
+#include <opie2/oresource.h>
#include <opie2/ostorageinfo.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/mimetype.h>
#include <qpe/applnk.h>
-#include <qpe/resource.h>
#include <qpe/menubutton.h>
#include <qcombobox.h>
#include <qpopupmenu.h>
#include <qlistview.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <sys/stat.h>
#include <time.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/vfs.h>
#include <mntent.h>
using namespace Opie::Ui;
AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
: QMainWindow( ) {
init();
renameBox = 0;
whichTab = 1;
- unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() );
+ unknownXpm = Opie::Core::OResource::loadImage("UnknownDocument", Opie::Core::OResource::SmallIcon);
initConnections();
rePopulate();
channel = new QCopChannel( "QPE/Application/advancedfm", this );
connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&)));
switchToLocalTab();
}
AdvancedFm::~AdvancedFm() {
}
@@ -127,54 +126,49 @@ void AdvancedFm::populateView() {
fileL += "/";
isDir=TRUE;
}
}
QFileInfo fileInfo( path + "/" + fileL);
if(fileL !="./" && fi->exists()) {
item = new QListViewItem( thisView, fileL, fileS , fileDate);
if(isDir || fileL.find("/",0,TRUE) != -1) {
if( !QDir( fi->filePath() ).isReadable()) //is directory
- pm.convertFromImage( Resource::loadImage( "lockedfolder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
+ pm = Opie::Core::OResource::loadPixmap( "lockedfolder", Opie::Core::OResource::SmallIcon );
else
- pm.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
- }
+ pm = Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon );
+ }
else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
- pm.convertFromImage( Resource::loadImage( "exec" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
+ pm = Opie::Core::OResource::loadPixmap( "exec", Opie::Core::OResource::SmallIcon );
}
else if( (fileInfo.permission( QFileInfo::ExeUser)
| fileInfo.permission( QFileInfo::ExeGroup)
| fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
- pm.convertFromImage( Resource::loadImage( "exec" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
+ pm = Opie::Core::OResource::loadPixmap( "exec", Opie::Core::OResource::SmallIcon );
}
else if( !fi->isReadable() ) {
- pm.convertFromImage( Resource::loadImage( "locked" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
+ pm = Opie::Core::OResource::loadPixmap( "locked", Opie::Core::OResource::SmallIcon );
}
else { //everything else goes by mimetype
MimeType mt(fi->filePath());
pm=mt.pixmap(); //sets the correct pixmap for mimetype
if(pm.isNull()) {
pm = unknownXpm;
}
}
if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
// odebug << " overlay link image" << oendl;
- pm.convertFromImage( Resource::loadImage( "advancedfm/symlink" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
- // pm= Resource::loadPixmap( "folder" );
-// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
-// QPainter painter( &pm );
-// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
-// pm.setMask( pm.createHeuristicMask( FALSE ) );
+ pm = Opie::Core::OResource::loadPixmap( "advancedfm/symlink", Opie::Core::OResource::SmallIcon );
}
item->setPixmap( 0, pm );
}
isDir=FALSE;
++it;
}
if( path.find("dev",0,TRUE) != -1) {
struct stat buf;
dev_t devT;
DIR *dir;
@@ -451,25 +445,26 @@ void AdvancedFm::showFileMenu() {
// QPopupMenu *o = new QPopupMenu(0);
m->insertItem(tr("Show Hidden Files"),this,SLOT(showHidden()));
if ( QFileInfo(fi).isDir()) {
m->insertSeparator();
m->insertItem(tr("Change Directory"),this,SLOT(doDirChange()));
} else {
if (app)
m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis()));
else if(QFileInfo(fi).isExecutable() ) //damn opie doesnt like this
m->insertItem(tr("Execute"),this,SLOT(runThis()));
- m->insertItem(Resource::loadPixmap("txt"),tr("Open as text"),this,SLOT(runText()));
+ m->insertItem( Opie::Core::OResource::loadPixmap( "txt", Opie::Core::OResource::SmallIcon ),
+ tr("Open as text"),this,SLOT(runText()));
}
m->insertItem(tr("Actions"),n);
n->insertItem(tr("Make Directory"),this,SLOT(makeDir()));
n->insertItem(tr("Make Symlink"),this,SLOT(mkSym()));
n->insertSeparator();
n->insertItem(tr("Rename"),this,SLOT(renameIt()));
n->insertItem(tr("Copy"),this,SLOT(copyTimer()));
n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer()));
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index b43d2ba..aa9db52 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -4,28 +4,28 @@
** Created: Mon 09-23-2002 13:24:11
copyright : (C) 2002 by ljp
email : ljp@llornkcor.com
* 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 "advancedfm.h"
/* OPIE */
#include <opie2/odebug.h>
+#include <opie2/oresource.h>
#include <qpe/applnk.h>
#include <qpe/storage.h>
#include <qpe/qpeapplication.h>
-#include <qpe/resource.h>
#include <qpe/menubutton.h>
using namespace Opie::Core;
using namespace Opie::Ui;
/* QT */
#include <qlayout.h>
#include <qhbox.h>
#include <qmenubar.h>
#include <qcombobox.h>
#include <qtoolbutton.h>
#include <qlineedit.h>
#include <qlistview.h>
@@ -43,58 +43,59 @@ void AdvancedFm::init() {
QMenuBar *menuBar = new QMenuBar(this);
menuBar->setMargin( 0 ); // squeeze
fileMenu = new QPopupMenu( this );
viewMenu = new QPopupMenu( this );
// customDirMenu = new QPopupMenu( this );
layout->addWidget( menuBar );
menuBar->insertItem( tr( "File" ), fileMenu);
menuBar->insertItem( tr( "View" ), viewMenu);
- QPixmap pm;
+ bool useBigIcon = qApp->desktop()->size().width() > 330;
+
cdUpButton = new QToolButton( 0,"cdUpButton");
- pm.convertFromImage( Resource::loadImage( "up" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
- cdUpButton->setPixmap( pm );
+ cdUpButton->setUsesBigPixmap( useBigIcon );
+ cdUpButton->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) );
cdUpButton->setAutoRaise( true );
menuBar->insertItem( cdUpButton );
qpeDirButton= new QToolButton( 0,"QPEButton");
- pm.convertFromImage( Resource::loadImage( "logo/opielogo" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
- qpeDirButton->setPixmap( pm );//,"",this,"QPEButton");
+ qpeDirButton->setUsesBigPixmap( useBigIcon );
+ qpeDirButton->setPixmap( Opie::Core::OResource::loadPixmap( "logo/opielogo", Opie::Core::OResource::SmallIcon ) );
qpeDirButton->setAutoRaise( true );
menuBar->insertItem( qpeDirButton );
cfButton = new QToolButton( 0, "CFButton");
- pm.convertFromImage( Resource::loadImage( "cardmon/pcmcia" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
- cfButton->setPixmap( pm );
+ cfButton->setUsesBigPixmap( useBigIcon );
+ cfButton->setPixmap( Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ) );
cfButton->setAutoRaise( true );
menuBar->insertItem( cfButton );
sdButton = new QToolButton( 0, "SDButton");
- pm.convertFromImage( Resource::loadImage( "advancedfm/sdcard" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
- sdButton->setPixmap( pm );
+ sdButton->setUsesBigPixmap( useBigIcon );
+ sdButton->setPixmap( Opie::Core::OResource::loadPixmap( "advancedfm/sdcard", Opie::Core::OResource::SmallIcon ) );
sdButton->setAutoRaise( true );
menuBar->insertItem( sdButton );
docButton = new QToolButton( 0,"docsButton");
- pm.convertFromImage( Resource::loadImage( "DocsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
- docButton->setPixmap( pm );
+ docButton->setUsesBigPixmap( useBigIcon );
+ docButton->setPixmap( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ) );
docButton->setAutoRaise( true );
menuBar->insertItem( docButton );
homeButton = new QToolButton( 0, "homeButton");
- pm.convertFromImage( Resource::loadImage( "home" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
- homeButton->setPixmap( pm );
+ homeButton->setUsesBigPixmap( useBigIcon );
+ homeButton->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) );
homeButton->setAutoRaise( true );
menuBar->insertItem( homeButton );
fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
fileMenu->insertSeparator();
fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() ));
fileMenu->insertSeparator();
fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));