summaryrefslogtreecommitdiff
authorzecke <zecke>2004-08-18 22:07:30 (UTC)
committer zecke <zecke>2004-08-18 22:07:30 (UTC)
commit50636a24f8ec2e603f1888a18dba044a1045bf0b (patch) (side-by-side diff)
tree9f69140b2449aaefe263e7acab3b6b147c7fadf7
parenteb0a70826bc77c8b4008bd0444218da7612d32a9 (diff)
downloadopie-50636a24f8ec2e603f1888a18dba044a1045bf0b.zip
opie-50636a24f8ec2e603f1888a18dba044a1045bf0b.tar.gz
opie-50636a24f8ec2e603f1888a18dba044a1045bf0b.tar.bz2
-Remove #ifdef for NOQUICKLAUNCH as OPIE_EXPORT_APP works for
both cases already. -Use QPEApplication::setStylusOperation for RightOnHold feature instead of custom code
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp57
-rw-r--r--noncore/apps/advancedfm/advancedfm.h8
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp15
-rw-r--r--noncore/apps/advancedfm/main.cpp2
4 files changed, 31 insertions, 51 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index a47edd8..afb44f5 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -30,21 +30,17 @@
#include <time.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/vfs.h>
#include <mntent.h>
using namespace Opie::Ui;
-#ifdef NOQUICKLAUNCH
-AdvancedFm::AdvancedFm( )
-#else
AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
-#endif
: QMainWindow( ) {
init();
renameBox = 0;
unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
initConnections();
whichTab=1;
@@ -66,17 +62,17 @@ void AdvancedFm::cleanUp() {
else
sfile+="._temp";
QFile file( sfile);
if(file.exists())
file.remove();
}
void AdvancedFm::tabChanged(QWidget *) {
-// owarn << "tab changed" << oendl;
+// owarn << "tab changed" << oendl;
QString path = CurrentDir()->canonicalPath();
currentPathCombo->lineEdit()->setText( path );
if(whichTab == 1) {
viewMenu->setItemChecked(viewMenu->idAt(0), true);
viewMenu->setItemChecked(viewMenu->idAt(1), false);
} else {
viewMenu->setItemChecked(viewMenu->idAt(0), false);
@@ -88,23 +84,23 @@ void AdvancedFm::tabChanged(QWidget *) {
setCaption(tr("AdvancedFm :: ")+fs+" :: "
+checkDiskSpace( (const QString &) path )+ tr(" kB free") );
chdir( path.latin1());
}
void AdvancedFm::populateView() {
-// owarn << "PopulateView" << oendl;
+// owarn << "PopulateView" << oendl;
QPixmap pm;
QListView *thisView = CurrentView();
QDir *thisDir = CurrentDir();
QString path = thisDir->canonicalPath();
-//owarn << "path is "+path << oendl;
+//owarn << "path is "+path << oendl;
thisView->clear();
thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
thisDir->setMatchAllDirs(TRUE);
thisDir->setNameFilter(filterStr);
QString fileL, fileS, fileDate;
QString fs= getFileSystemType((const QString &) path);
setCaption(tr("AdvancedFm :: ")+fs+" :: "
+checkDiskSpace((const QString &) path)+ tr(" kB free") );
@@ -155,17 +151,17 @@ void AdvancedFm::populateView() {
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;
+ // odebug << " overlay link image" << oendl;
pm= Resource::loadPixmap( "advancedfm/symlink" );
// 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 ) );
}
item->setPixmap( 0,pm);
@@ -179,17 +175,17 @@ void AdvancedFm::populateView() {
struct stat buf;
dev_t devT;
DIR *dir;
struct dirent *mydirent;
if((dir = opendir( path.latin1())) != NULL)
while ((mydirent = readdir(dir)) != NULL) {
lstat( mydirent->d_name, &buf);
-// odebug << mydirent->d_name << oendl;
+// odebug << mydirent->d_name << oendl;
fileL.sprintf("%s", mydirent->d_name);
devT = buf.st_dev;
fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
fileDate.sprintf("%s", ctime( &buf.st_mtime));
if( fileL.find(".") == -1 ) {
item= new QListViewItem( thisView, fileL, fileS, fileDate);
pm = unknownXpm;
item->setPixmap( 0,pm);
@@ -204,30 +200,30 @@ void AdvancedFm::populateView() {
}
void AdvancedFm::rePopulate() {
populateView();
setOtherTabCurrent();
populateView();
// int tmpTab = whichTab;
-// // odebug << "" << tmpTab << "" << oendl;
+// // odebug << "" << tmpTab << "" << oendl;
// for(int i =1; i < 3; i++) {
// TabWidget->setCurrentWidget(i - 1);
// populateView();
// }
// TabWidget->setCurrentWidget( tmpTab - 1);
}
void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
-//owarn << "listclicked" << oendl;
+//owarn << "listclicked" << oendl;
if(selectedItem) {
QString strItem=selectedItem->text(0);
-// owarn << strItem << oendl;
+// owarn << strItem << oendl;
QString strSize=selectedItem->text(1);
strSize=strSize.stripWhiteSpace();
bool isDirectory = false;
QString strItem2;
if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink
strItem2 = dealWithSymName((const QString&)strItem);
if(QDir(strItem2).exists() )
@@ -254,31 +250,28 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , in
switch (mouse) {
case 1:
{
if(renameBox != 0 ) {
cancelRename();
}
}
break;
- case 2:
- menuTimer.start( 500, TRUE );
- break;
};
}
void AdvancedFm::switchToLocalTab() {
-//owarn << "switch to local view" << oendl;
+//owarn << "switch to local view" << oendl;
TabWidget->setCurrentWidget(0);
Local_View->setFocus();
}
void AdvancedFm::switchToRemoteTab() {
-//owarn << "switch to local view" << oendl;
+//owarn << "switch to local view" << oendl;
TabWidget->setCurrentWidget(1);
Remote_View->setFocus();
}
void AdvancedFm::readConfig() {
Config cfg("AdvancedFm");
}
@@ -324,17 +317,17 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
QStringList AdvancedFm::getPath() {
QStringList strList;
QListView *thisView=CurrentView();
QList<QListViewItem> * getSelectedItems( QListView * thisView );
QListViewItemIterator it( thisView );
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
strList << it.current()->text(0);
-// odebug << it.current()->text(0) << oendl;
+// odebug << it.current()->text(0) << oendl;
}
}
return strList;
}
void AdvancedFm::homeButtonPushed() {
QString current = QDir::homeDirPath();
chdir( current.latin1() );
@@ -375,17 +368,17 @@ void AdvancedFm::CFButtonPushed() {
void AdvancedFm::doAbout() {
QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n"
"is copyright 2002-2003 by\n"
"L.J.Potter<llornkcor@handhelds.org>\n"
"and is licensed by the GPL"));
}
void AdvancedFm::keyPressEvent( QKeyEvent *e) {
-// owarn << "key " << e->key() << "" << oendl;
+// owarn << "key " << e->key() << "" << oendl;
// if( CurrentView()->hasFocus() )
{
switch ( e->key() ) {
case Key_Left:
upDir();
break;
case Key_Next:
break;
@@ -601,22 +594,16 @@ void AdvancedFm::showFileMenu() {
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
if(m) delete m;
}
-void AdvancedFm::cancelMenuTimer() {
-
- if( menuTimer.isActive() )
- menuTimer.stop();
-}
-
QString AdvancedFm::checkDiskSpace(const QString &path) {
struct statfs fss;
if ( !statfs( path.latin1(), &fss ) ) {
int blkSize = fss.f_bsize;
// int totalBlks = fs.f_blocks;
int availBlks = fss.f_bavail;
long mult = blkSize / 1024;
@@ -633,17 +620,17 @@ QString AdvancedFm::checkDiskSpace(const QString &path) {
void AdvancedFm::addToDocs() {
QStringList strListPaths = getPath();
QDir *thisDir = CurrentDir();
if( strListPaths.count() > 0) {
QString curFile;
for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
curFile = thisDir->canonicalPath()+"/"+(*it);
-// odebug << curFile << oendl;
+// odebug << curFile << oendl;
QFileInfo fi(curFile);
DocLnk f;
// curFile.replace(QRegExp("\\..*"),"");
f.setName(fi.baseName() );
f.setFile( curFile);
f.writeLink();
}
}
@@ -706,17 +693,17 @@ void AdvancedFm::addCustomDir() {
list << dir;
}
cfg.writeEntry("CustomDir", list, ',');
cfg.write();
}
void AdvancedFm::removeCustomDir() {
-// odebug << "remove custom dir" << oendl;
+// odebug << "remove custom dir" << oendl;
Config cfg("AdvancedFm");
cfg.setGroup("Menu");
QString dir;
QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)',');
QStringList list2;
dir = CurrentDir()->canonicalPath();
int ramble=2;
// int ramble=-24;
@@ -741,17 +728,17 @@ void AdvancedFm::removeCustomDir() {
cfg.writeEntry("CustomDir", list2, ',');
cfg.write();
}
// customDirsToMenu();
}
void AdvancedFm::gotoCustomDir(const QString &dir) {
-// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl;
+// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl;
// QString curDir = dir;
// QDir *thisDir = CurrentDir();
// if( curDir.isEmpty()) {
// }
if( dir == s_addBookmark) {
addCustomDir();
}
if( dir == s_removeBookmark) {
@@ -782,60 +769,60 @@ QDir *AdvancedFm::OtherDir() {
return &currentRemoteDir;
} else {
return &currentDir;
}
}
QListView * AdvancedFm::CurrentView() {
if ( whichTab == 1) {
-// owarn << "CurrentView Tab 1" << oendl;
+// owarn << "CurrentView Tab 1" << oendl;
return Local_View;
} else {
-// owarn << "CurrentView Tab 2" << oendl;
+// owarn << "CurrentView Tab 2" << oendl;
return Remote_View;
}
}
QListView * AdvancedFm::OtherView() {
if ( whichTab == 1)
return Remote_View;
else
return Local_View;
}
void AdvancedFm::setOtherTabCurrent() {
-// owarn << "setOtherTabCurrent() " << whichTab << "" << oendl;
+// owarn << "setOtherTabCurrent() " << whichTab << "" << oendl;
if ( whichTab == 1) {
TabWidget->setCurrentWidget(1);
} else {
TabWidget->setCurrentWidget(0);
}
OtherView()->setFocus();
OtherView()->setSelected( CurrentView()->firstChild(), true);
}
void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
-// odebug << "qcop message "+msg << oendl;
+// odebug << "qcop message "+msg << oendl;
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "openDirectory(QString)" ) {
-// odebug << "received" << oendl;
+// odebug << "received" << oendl;
QString file;
stream >> file;
gotoDirectory( (const QString &) file);
}
}
void AdvancedFm::setDocument(const QString &file) {
gotoDirectory( file);
}
void AdvancedFm::gotoDirectory(const QString &file) {
-// owarn << "goto dir "+file << oendl;
+// owarn << "goto dir "+file << oendl;
QString curDir = file;
QDir *thisDir = CurrentDir();
if(QDir( curDir).exists() ) {
thisDir->setPath( curDir );
chdir( curDir.latin1() );
thisDir->cd( curDir, TRUE);
populateView();
}
@@ -861,17 +848,17 @@ void AdvancedFm::findFile(const QString &fileName) {
if(it.current()->text(0) == fi.fileName()) {
it.current()->setSelected(true);
thisView->ensureItemVisible(it.current());
}
}
}
void AdvancedFm::slotSwitchMenu(int ) {
-// odebug << "Switch " << item << "" << oendl;
+// odebug << "Switch " << item << "" << oendl;
// viewMenu->setItemChecked(item, true);
}
void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) {
tabChanged( w);
if( w == Local_View) {
Remote_View->clearFocus();
} else {
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 4eaa6d6..effda0b 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -50,21 +50,17 @@ class MenuButton;
class QToolButton;
class Ir;
class AdvancedFm : public QMainWindow
{
Q_OBJECT
public:
static QString appName() { return QString::fromLatin1("advancedfm"); }
-#ifdef NOQUICKLAUNCH
- AdvancedFm();
-#else
AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0);
-#endif
~AdvancedFm();
protected slots:
void slotSwitchMenu(int);
void selectAll();
void addToDocs();
void doDirChange();
void mkDir();
void del();
@@ -133,18 +129,17 @@ protected:
QListView *CurrentView();
QListView *OtherView();
void setOtherTabCurrent();
void dealWithSchmooSchmaa(QWidget *);
protected slots:
void openSearch();
void dirMenuSelected(int);
- void showFileMenu();
- void cancelMenuTimer();
+ void showFileMenu();
void homeButtonPushed();
void docButtonPushed();
void SDButtonPushed();
void CFButtonPushed();
void QPEButtonPushed();
void upDir();
void currentPathComboChanged();
void copy();
@@ -161,17 +156,16 @@ protected slots:
bool copyDirectory( const QString & , const QString & );
// void navigateToSelected();
bool moveDirectory( const QString & , const QString & );
// void slotSwitchtoLocal(int);
private:
MenuButton *menuButton;
QString oldName;
- QTimer menuTimer;
void startProcess(const QString &);
bool eventFilter( QObject * , QEvent * );
void cancelRename();
void doRename(QListView *);
void okRename();
void customDirsToMenu();
void addCustomDir();
void removeCustomDir();
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index 29335f8..dc7e8e1 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -156,17 +156,17 @@ void AdvancedFm::init() {
Local_View->addColumn( tr("Date"),-1);
Local_View->setColumnAlignment(2,QListView::AlignRight);
Local_View->setAllColumnsShowFocus(TRUE);
Local_View->setMultiSelection( TRUE );
Local_View->setSelectionMode(QListView::Extended);
Local_View->setFocusPolicy(StrongFocus);
Local_View->installEventFilter( this );
- QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
+ QPEApplication::setStylusOperation( Local_View->viewport() , QPEApplication::RightOnHold);
tabLayout->addWidget( Local_View, 0, 0 );
TabWidget->addWidget( tab,"advancedfm/smFileBrowser.png", tr("1"));
// TabWidget->insertTab( tab, tr("1"));
tab_2 = new QWidget( TabWidget, "tab_2" );
tabLayout_2 = new QGridLayout( tab_2 );
@@ -180,17 +180,17 @@ void AdvancedFm::init() {
Remote_View->addColumn( tr("Date"),-1);
Remote_View->setColumnAlignment(2,QListView::AlignRight);
Remote_View->setAllColumnsShowFocus(TRUE);
Remote_View->setMultiSelection( TRUE );
Remote_View->setSelectionMode(QListView::Extended);
Remote_View->setFocusPolicy(StrongFocus);
Remote_View->installEventFilter( this );
- QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
+ QPEApplication::setStylusOperation( Remote_View->viewport(), QPEApplication::RightOnHold);
tabLayout_2->addWidget( Remote_View, 0, 0 );
TabWidget->addWidget( tab_2, "advancedfm/smFileBrowser.png",tr( "2"));
TabWidget->setSizeChange( 370 );
// TabWidget->insertTab( tab_2, tr( "2"));
/* tab_3 = new QWidget( TabWidget, "tab_3" );
@@ -218,21 +218,21 @@ void AdvancedFm::init() {
if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
zaurusDevice=TRUE;
else
zaurusDevice=FALSE;
if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) {
- odebug << "not have sd" << oendl;
+ odebug << "not have sd" << oendl;
sdButton->hide();
}
if( !StorageInfo::hasCf() ) {
- odebug << "not have cf" << oendl;
+ odebug << "not have cf" << oendl;
cfButton->hide();
}
currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
currentDir.setPath( QDir::currentDirPath());
currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
currentRemoteDir.setPath( QDir::currentDirPath());
@@ -268,27 +268,28 @@ void AdvancedFm::initConnections()
this,SLOT(currentPathComboChanged()));
connect( Local_View, SIGNAL( clicked(QListViewItem*)),
this,SLOT( ListClicked(QListViewItem*)) );
connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) );
- connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
-
connect( Remote_View, SIGNAL( clicked(QListViewItem*)),
this,SLOT( ListClicked(QListViewItem*)) );
connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) );
connect( TabWidget,SIGNAL(currentChanged(QWidget*)),
this,SLOT(tabChanged(QWidget*)));
- connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
+ connect( Remote_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&, int)),
+ this, SLOT(showFileMenu()));
+ connect( Local_View, SIGNAL(rightButtonPressed(QListViewItem*, const QPoint&,int)),
+ this, SLOT(showFileMenu()));
connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&)));
// connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int)));
connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int)));
// connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int)));
}
diff --git a/noncore/apps/advancedfm/main.cpp b/noncore/apps/advancedfm/main.cpp
index df0d4af..06fc741 100644
--- a/noncore/apps/advancedfm/main.cpp
+++ b/noncore/apps/advancedfm/main.cpp
@@ -1,12 +1,10 @@
/***************************************************************************
-using namespace Opie::Core;
-using namespace Opie::Core;
main.cpp - description
-------------------
begin : March 10, 2002
copyright : (C) 2002 by llornkcor
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 *