author | zecke <zecke> | 2004-08-18 22:07:30 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-08-18 22:07:30 (UTC) |
commit | 50636a24f8ec2e603f1888a18dba044a1045bf0b (patch) (side-by-side diff) | |
tree | 9f69140b2449aaefe263e7acab3b6b147c7fadf7 | |
parent | eb0a70826bc77c8b4008bd0444218da7612d32a9 (diff) | |
download | opie-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
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 13 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 6 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/advancedfm/main.cpp | 2 |
4 files changed, 4 insertions, 24 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 @@ -1,90 +1,86 @@ /*************************************************************************** AdvancedFm.cpp ------------------- ** 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 <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; -#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; rePopulate(); currentPathCombo->setFocus(); channel = new QCopChannel( "QPE/Application/advancedfm", this ); connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); } AdvancedFm::~AdvancedFm() { } void AdvancedFm::cleanUp() { QString sfile=QDir::homeDirPath(); if(sfile.right(1) != "/") sfile+="/._temp"; else sfile+="._temp"; QFile file( sfile); if(file.exists()) file.remove(); } void AdvancedFm::tabChanged(QWidget *) { // 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); viewMenu->setItemChecked(viewMenu->idAt(1), true); } QString fs= getFileSystemType( (const QString &) path); setCaption(tr("AdvancedFm :: ")+fs+" :: " +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); chdir( path.latin1()); @@ -214,99 +210,96 @@ void AdvancedFm::rePopulate() { // for(int i =1; i < 3; i++) { // TabWidget->setCurrentWidget(i - 1); // populateView(); // } // TabWidget->setCurrentWidget( tmpTab - 1); } void AdvancedFm::ListClicked(QListViewItem *selectedItem) { //owarn << "listclicked" << oendl; if(selectedItem) { QString strItem=selectedItem->text(0); // 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() ) strItem = strItem2; } if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { if(QDir(strItem).exists()) isDirectory = true; } if( isDirectory ) { CurrentDir()->cd( strItem, TRUE); populateView(); CurrentView()->ensureItemVisible( CurrentView()->firstChild()); } chdir( strItem.latin1()); } } void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { dealWithSchmooSchmaa( item->listView()); 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; TabWidget->setCurrentWidget(0); Local_View->setFocus(); } void AdvancedFm::switchToRemoteTab() { //owarn << "switch to local view" << oendl; TabWidget->setCurrentWidget(1); Remote_View->setFocus(); } void AdvancedFm::readConfig() { Config cfg("AdvancedFm"); } void AdvancedFm::writeConfig() { Config cfg("AdvancedFm"); } void AdvancedFm::currentPathComboChanged() { if(QDir( currentPathCombo->lineEdit()->text()).exists()) { CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); populateView(); } else { QMessageBox::message(tr("Note"),tr("That directory does not exist")); } } void AdvancedFm::fillCombo(const QString ¤tPath) { if ( whichTab == 1) { currentPathCombo->lineEdit()->setText( currentPath); if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { currentPathCombo->clear(); localDirPathStringList.prepend( currentPath ); currentPathCombo->insertStringList( localDirPathStringList,-1); } } else { currentPathCombo->lineEdit()->setText( currentPath); if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { currentPathCombo->clear(); remoteDirPathStringList.prepend( currentPath ); currentPathCombo->insertStringList( remoteDirPathStringList,-1); @@ -561,102 +554,96 @@ void AdvancedFm::showFileMenu() { + 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(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( copy() )); n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); n->insertItem( tr( "Move" ), this, SLOT( move() )); n->insertSeparator(); n->insertItem( tr( "Delete" ), this, SLOT( doDelete() )); m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); m->insertSeparator(); m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); #if defined(QT_QWS_OPIE) m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); #endif m->setCheckable(TRUE); if (!b) m->setItemChecked(m->idAt(0),TRUE); else m->setItemChecked(m->idAt(0),FALSE); if(Ir::supported()) m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); 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; long div = 1024 / blkSize; if ( !mult ) mult = 1; if ( !div ) div = 1; return QString::number(availBlks * mult / div); } return ""; } 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; QFileInfo fi(curFile); DocLnk f; // curFile.replace(QRegExp("\\..*"),""); f.setName(fi.baseName() ); f.setFile( curFile); f.writeLink(); } } } void AdvancedFm::customDirsToMenu() { Config cfg("AdvancedFm"); cfg.setGroup("Menu"); QStringList list = cfg.readListEntry( "CustomDir", ','); menuButton->insertItems(list ); // for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) // { 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 @@ -10,182 +10,176 @@ * (at your option) any later version. * ***************************************************************************/ #ifndef ADVANCEDFM_H #define ADVANCEDFM_H #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties #define QT_QWS_OPIE #include <opie2/oprocess.h> #include <opie2/osplitter.h> #include <qpe/ir.h> #include <qpe/qcopenvelope_qws.h> #include <qvariant.h> #include <qdialog.h> #include <qmainwindow.h> #include <qstringlist.h> #include <qdir.h> #include <qstring.h> #include <qpoint.h> #include <qtimer.h> #include <qpixmap.h> class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QComboBox; class QListView; class QListviewItem; class QLabel; class QProgressBar; class QSpinBox; class QWidget; class QPopupMenu; class QFile; class QListViewItem; class QLineEdit; 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(); void rn(); void populateView(); void rePopulate(); void showHidden(); void showMenuHidden(); void writeConfig(); void readConfig(); void ListClicked(QListViewItem *); void ListPressed( int, QListViewItem *, const QPoint&, int); void makeDir(); void doDelete(); void tabChanged(QWidget*); void cleanUp(); void renameIt(); void runThis(); void runText(); void filePerms(); void doProperties(); void runCommand(); void runCommandStd(); QStringList getPath(); void mkSym(); void switchToLocalTab(); void switchToRemoteTab(); protected: Opie::Ui::OSplitter *TabWidget; QCopChannel * channel; QPixmap unknownXpm; int whichTab; // QTabWidget *TabWidget; QWidget *tab, *tab_2, *tab_3; QListView *Local_View, *Remote_View; QLineEdit *currentPathEdit; QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; // QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; QDir currentDir, currentRemoteDir; QComboBox *currentPathCombo; QString filterStr, s_addBookmark, s_removeBookmark; QListViewItem * item; bool b; QStringList fileSystemTypeList, fsList; int currentServerConfig; bool zaurusDevice; QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; QStringList remoteDirPathStringList, localDirPathStringList; QLineEdit *renameBox; void init(); void initConnections(); void keyReleaseEvent( QKeyEvent *); void keyPressEvent( QKeyEvent *); QString getFileSystemType(const QString &); QString getDiskSpace(const QString &); void parsetab(const QString &fileName); QString checkDiskSpace(const QString &); QString dealWithSymName(const QString &); QDir *CurrentDir(); QDir *OtherDir(); QListView *CurrentView(); QListView *OtherView(); void setOtherTabCurrent(); void dealWithSchmooSchmaa(QWidget *); protected slots: void openSearch(); void dirMenuSelected(int); void showFileMenu(); - void cancelMenuTimer(); void homeButtonPushed(); void docButtonPushed(); void SDButtonPushed(); void CFButtonPushed(); void QPEButtonPushed(); void upDir(); void currentPathComboChanged(); void copy(); void copyAs(); void copySameDir(); void currentPathComboActivated(const QString &); void fillCombo(const QString &); bool copyFile( const QString & , const QString & ); void move(); void fileStatus(); void doAbout(); void doBeam(); void fileBeamFinished( Ir *); 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(); void gotoDirectory(const QString &); void navigateToSelected(); void findFile(const QString &); private slots: void processEnded(Opie::Core::OProcess *); void oprocessStderr(Opie::Core::OProcess *, char *, int); void gotoCustomDir(const QString &); void qcopReceive(const QCString&, const QByteArray&); void setDocument(const QString &); }; #endif // ADVANCEDFM_H 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 @@ -228,67 +228,68 @@ void AdvancedFm::init() { } if( !StorageInfo::hasCf() ) { 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()); // b = TRUE; filterStr="*"; showMenuHidden(); TabWidget->setCurrentWidget(0); } void AdvancedFm::initConnections() { connect( qApp,SIGNAL( aboutToQuit()), this, SLOT( cleanUp()) ); connect( qpeDirButton ,SIGNAL(released()), this,SLOT( QPEButtonPushed()) ); connect( cfButton ,SIGNAL(released()), this,SLOT( CFButtonPushed()) ); connect( sdButton ,SIGNAL(released()), this,SLOT( SDButtonPushed()) ); connect( cdUpButton ,SIGNAL(released()), this,SLOT( upDir()) ); connect( docButton,SIGNAL(released()), this,SLOT( docButtonPushed()) ); connect( homeButton,SIGNAL(released()), this,SLOT( homeButtonPushed()) ); connect( currentPathCombo, SIGNAL( activated(const QString&) ), this, SLOT( currentPathComboActivated(const QString&) ) ); connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 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,22 +1,20 @@ /*************************************************************************** -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 * * (at your option) any later version. * ***************************************************************************/ #include "advancedfm.h" #include <opie2/oapplicationfactory.h> using namespace Opie::Core; OPIE_EXPORT_APP( OApplicationFactory<AdvancedFm> ) |