author | llornkcor <llornkcor> | 2003-02-23 03:36:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-02-23 03:36:24 (UTC) |
commit | d51ca116a8c4d234db93021ccad36506980c317f (patch) (side-by-side diff) | |
tree | 62fcb42c66ec95bbbb8d81b629fad7a7d4db4a1b | |
parent | 98ed23c5281a57d08c6c18b464fc50b4638385f8 (diff) | |
download | opie-d51ca116a8c4d234db93021ccad36506980c317f.zip opie-d51ca116a8c4d234db93021ccad36506980c317f.tar.gz opie-d51ca116a8c4d234db93021ccad36506980c317f.tar.bz2 |
added menubutton directory bookmarks
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 209 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 42 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 56 |
3 files changed, 264 insertions, 43 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 9edf7c1..d8bdff7 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -3,44 +3,48 @@ ------------------- ** 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 <opie/otabwidget.h> // #include <opie/ofileselector.h> // #include <opie/ofiledialog.h> +#include <qpe/config.h> #include <qpe/filemanager.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/qpeapplication.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/config.h> #include <qpe/mimetype.h> #include <qpe/applnk.h> #include <qpe/ir.h> #include <qpe/resource.h> +#include <qpe/menubutton.h> + +#include <qregexp.h> #include <qtabwidget.h> #include <qtextstream.h> #include <qpushbutton.h> #include <qdatetime.h> #include <qdir.h> #include <qfile.h> #include <qstring.h> #include <qcombobox.h> #include <qpopupmenu.h> #include <qlistview.h> #include <qmainwindow.h> #include <qlabel.h> #include <qprogressbar.h> #include <qspinbox.h> #include <qwidget.h> #include <qlayout.h> @@ -77,33 +81,33 @@ AdvancedFm::AdvancedFm( ) 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 *w) { - qDebug("tab changed %d",TabWidget->getCurrentTab()); +// qDebug("tab changed %d",TabWidget->getCurrentTab()); if ( w == tab) { // if (TabWidget->getCurrentTab() == 0) { // if (TabWidget->currentPageIndex() == 0) { currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); setCaption("AdvancedFm :: "+fs+" :: " +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); } if ( w == tab_2) { // if (TabWidget->getCurrentTab() == 1) { // if (TabWidget->currentPageIndex() == 1) { @@ -181,33 +185,33 @@ void AdvancedFm::populateLocalView() { pm.setMask( pm.createHeuristicMask( FALSE ) ); item->setPixmap( 0, pm); } } isDir=FALSE; ++it; } if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { struct stat buf; dev_t devT; DIR *dir; struct dirent *mydirent; if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) while ((mydirent = readdir(dir)) != NULL) { lstat( mydirent->d_name, &buf); - qDebug(mydirent->d_name); +// qDebug(mydirent->d_name); 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( Local_View, fileL, fileS, fileDate); pm = Resource::loadPixmap( "UnknownDocument-14" ); item->setPixmap( 0,pm); } } closedir(dir); } Local_View->setSorting( 3,FALSE); fillCombo( (const QString &) currentDir.canonicalPath()); @@ -280,33 +284,33 @@ void AdvancedFm::populateRemoteView() { painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); pm.setMask( pm.createHeuristicMask( FALSE ) ); } item->setPixmap( 0, pm); } isDir=FALSE; ++it; } if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { struct stat buf; DIR *dir; struct dirent *mydirent; if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) while ((mydirent = readdir(dir)) != NULL) { lstat( mydirent->d_name, &buf); - qDebug(mydirent->d_name); +// qDebug(mydirent->d_name); fileL.sprintf("%s", mydirent->d_name); fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); fileDate.sprintf("%s", ctime( &buf.st_mtime)); if( fileL.find(".") == -1 ){ item= new QListViewItem( Remote_View, fileL, fileS, fileDate); pm = Resource::loadPixmap( "UnknownDocument-14" ); item->setPixmap( 0,pm); } } closedir(dir); } Remote_View->setSorting( 3,FALSE); fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); } @@ -394,60 +398,60 @@ void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) { // Remote_View->clearSelection(); } } //end not symlink chdir(strItem.latin1()); } } } void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { // qDebug("list pressed"); switch (mouse) { case 1: { if(renameBox != 0 ) { - qDebug("cancel rename"); +// qDebug("cancel rename"); cancelRename(); } } break; case 2: menuTimer.start( 500, TRUE ); - qDebug("Start menu timer\n"); +// qDebug("Start menu timer\n"); break; }; } void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { switch (mouse) { case 1: { if(renameBox != 0 ) { - qDebug("cancel rename"); +// qDebug("cancel rename"); cancelRename(); } } break; case 2: menuTimer.start( 500, TRUE ); - qDebug("Start menu timer"); +// qDebug("Start menu timer"); break; }; } void AdvancedFm::switchToLocalTab() { TabWidget->setCurrentTab(0); Local_View->setFocus(); } void AdvancedFm::switchToRemoteTab() { TabWidget->setCurrentTab(1); Remote_View->setFocus(); } void AdvancedFm::readConfig() { @@ -467,33 +471,33 @@ void AdvancedFm::currentPathComboChanged() { } else { QMessageBox::message(tr("Note"),tr("That directory does not exist")); } } if (TabWidget->getCurrentTab() == 0) { // if (TabWidget->currentPageIndex() == 0) { if(QDir( currentPathCombo->lineEdit()->text()).exists()) { currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); populateRemoteView(); } else { QMessageBox::message(tr("Note"),tr("That directory does not exist")); } } } void AdvancedFm::fillCombo(const QString ¤tPath) { - qDebug("%d",TabWidget->getCurrentTab()); +// qDebug("%d",TabWidget->getCurrentTab()); if (TabWidget->getCurrentTab() == 0) { // if (TabWidget->currentPageIndex() == 0) { 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); } } @@ -510,43 +514,43 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath) { chdir( currentPath.latin1() ); currentRemoteDir.cd( currentPath, TRUE); populateRemoteView(); update(); } } QStringList AdvancedFm::getPath() { QStringList strList; if (TabWidget->getCurrentTab() == 0) { // if (TabWidget->currentPageIndex() == 0) { QList<QListViewItem> * getSelectedItems( QListView * Local_View ); QListViewItemIterator it( Local_View ); for ( ; it.current(); ++it ) { if ( it.current()->isSelected() ) { strList << it.current()->text(0); - qDebug(it.current()->text(0)); +// qDebug(it.current()->text(0)); } } return strList; } else { QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); QListViewItemIterator it( Remote_View ); for ( ; it.current(); ++it ) { if ( it.current()->isSelected() ) { strList << it.current()->text(0); - qDebug(it.current()->text(0)); +// qDebug(it.current()->text(0)); } } return strList; } return ""; } void AdvancedFm::homeButtonPushed() { QString current = QDir::homeDirPath(); chdir( current.latin1() ); if (TabWidget->getCurrentTab() == 0) { // if (TabWidget->currentPageIndex() == 0) { currentDir.cd( current, TRUE); populateLocalView(); } else { currentRemoteDir.cd( current, TRUE); @@ -862,38 +866,219 @@ QString AdvancedFm::checkDiskSpace(const QString &path) { if ( !div ) div = 1; return QString::number(availBlks * mult / div); } return ""; } void AdvancedFm::addToDocs() { QStringList strListPaths = getPath(); if( strListPaths.count() > 0) { QString curFile; if (TabWidget->getCurrentTab() == 0) { // if (TabWidget->currentPageIndex() == 0) { for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { curFile = currentDir.canonicalPath()+"/"+(*it); - qDebug(curFile); +// qDebug(curFile); DocLnk f; // curFile.replace(QRegExp("\\..*"),""); f.setName((*it)); f.setFile( curFile); f.writeLink(); } } else { for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { curFile = currentRemoteDir.canonicalPath()+"/"+(*it); - qDebug(curFile); +// qDebug(curFile); DocLnk f; // curFile.replace(QRegExp("\\..*"),""); f.setName((*it)); 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 ) +// { +// customDirMenu->insertItem(*it ); +// } +} + +void AdvancedFm::dirMenuSelected(int item) +{ + qDebug("menu item %d", item); + switch(item) + { + + case -21: + case 0: + addCustomDir(); + break; + case -22: + case 1: + removeCustomDir(); + break; + default: + { +// gotoCustomDir( menuButton->text(item)); +// gotoCustomDir( customDirMenu->text(item)); + } + break; + + }; +} + +void AdvancedFm::addCustomDir() +{ + Config cfg("AdvancedFm"); + cfg.setGroup("Menu"); + QString dir; + QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); + + if (TabWidget->getCurrentTab() == 0) + { + dir = currentDir.canonicalPath(); + } + else + { + dir = currentRemoteDir.canonicalPath(); + } + + bool addIt=true; + for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) + { + if( dir == (*it)) + { + addIt=false; + } + } + if(addIt) + { + menuButton->insertItem(dir); +// customDirMenu->insertItem(dir); + list << dir; + } + + cfg.writeEntry("CustomDir", list, ','); + cfg.write(); +} + +void AdvancedFm::removeCustomDir() +{ +// qDebug("remove custom dir"); + Config cfg("AdvancedFm"); + cfg.setGroup("Menu"); + QString dir; + QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); + QStringList list2; + + if (TabWidget->getCurrentTab() == 0) + { + dir = currentDir.canonicalPath(); + } + else + { + dir = currentRemoteDir.canonicalPath(); + } + int ramble=2; +// int ramble=-24; +//first remove list + if(list.grep(dir,true).isEmpty()) + { + QMessageBox::message("AdvancedFm",tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!!")); + } + else + { + for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) + { + if((*it) != dir)//current item is not our current dir, so add it to temp list + { + list2 <<(*it); + } + else + { +// customDirMenu->removeItem( ramble); + menuButton->remove( ramble); + + } + ramble++; +// ramble--; + } + + cfg.writeEntry("CustomDir", list2, ','); + cfg.write(); + } +// customDirsToMenu(); + +} + +void AdvancedFm::gotoCustomDir(const QString &dir) +{ +// qDebug("gotoCustomDir(const QString &dir) " +dir ); + QString curDir = dir; +// if( curDir.isEmpty()) { +// } + if( curDir == s_addBookmark) + { + addCustomDir(); + } + if( curDir == s_removeBookmark) + { + removeCustomDir( ); + } + else + { + if(QDir( curDir).exists() ) + { + if (TabWidget->getCurrentTab() == 0) + { + currentDir.setPath( curDir ); + chdir( curDir.latin1() ); + currentDir.cd( curDir, TRUE); + populateLocalView(); + } + else + { + currentRemoteDir.setPath( curDir ); + chdir( curDir.latin1() ); + currentRemoteDir.cd( curDir, TRUE); + populateRemoteView(); + } + } + } +// menuButton +// qDebug("gotoCustomDir(const QString &dir) " +dir ); +// QString curDir = dir; +// if(QDir( curDir).exists() ) +// { +// if (TabWidget->getCurrentTab() == 0) +// { +// currentDir.setPath( curDir ); +// chdir( curDir.latin1() ); +// currentDir.cd( curDir, TRUE); +// populateLocalView(); +// } +// else +// { +// currentRemoteDir.setPath( curDir ); +// chdir( curDir.latin1() ); +// currentRemoteDir.cd( curDir, TRUE); +// populateRemoteView(); +// } +// } +// menuButton->setLabel(" "); +// menuButton +} diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 42775ee..7478dcb 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h @@ -31,60 +31,44 @@ class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QComboBox; class QListView; class QListviewItem; class QLabel; class QProgressBar; class QSpinBox; class QTabWidget; class QWidget; class QPEToolBar; class QPEMenuBar; class QPopupMenu; class QFile; class QListViewItem; class QLineEdit; +class MenuButton; //class QPushButton; class QToolButton; class Ir; class AdvancedFm : public QMainWindow { Q_OBJECT public: AdvancedFm(); ~AdvancedFm(); - - OTabWidget *TabWidget; -// QTabWidget *TabWidget; - QWidget *tab, *tab_2, *tab_3; - QListView *Local_View, *Remote_View; - - QLineEdit *currentPathEdit; - QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; - QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; -// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; - QDir currentDir, currentRemoteDir; - QComboBox *currentPathCombo; - QString filterStr; - QListViewItem * item; - bool b; - QStringList fileSystemTypeList, fsList; - int currentServerConfig; protected slots: void selectAll(); void addToDocs(); void doLocalCd(); void doRemoteCd(); // void copy(); void mkDir(); void del(); void rn(); void populateLocalView(); void populateRemoteView(); void showHidden(); void showMenuHidden(); void showRemoteHidden(); void writeConfig(); void readConfig(); @@ -101,65 +85,89 @@ protected slots: void tabChanged(QWidget*); void cleanUp(); void remoteRename(); void localRename(); void runThis(); void runText(); void filePerms(); void doProperties(); void runCommand(); void runCommandStd(); QStringList getPath(); void mkSym(); void switchToLocalTab(); void switchToRemoteTab(); protected: + + OTabWidget *TabWidget; +// 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 *); QString getFileSystemType(const QString &); QString getDiskSpace(const QString &); void parsetab(const QString &fileName); QString checkDiskSpace(const QString &); QString dealWithSymName(const QString &); protected slots: + 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 *); 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(); + private slots: void processEnded(); + void gotoCustomDir(const QString &); }; #endif // ADVANCEDFM_H diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 0966f02..bb80dc6 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp @@ -3,129 +3,152 @@ ------------------- ** 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" #include <opie/otabwidget.h> #include <qpe/qpeapplication.h> #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> +#include <qpe/menubutton.h> +#include <qpe/config.h> #include <qlayout.h> #include <qpixmap.h> #include <qcombobox.h> #include <qpopupmenu.h> #include <qtabwidget.h> #include <qtoolbutton.h> #include <qlineedit.h> #include <qlistview.h> #include <sys/utsname.h> void AdvancedFm::init() { #if defined(QT_QWS_OPIE) qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!"); #endif setCaption( tr( "AdvancedFm" ) ); QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2); layout->setMargin( 2); QPEMenuBar *menuBar = new QPEMenuBar(this); fileMenu = new QPopupMenu( this ); viewMenu = new QPopupMenu( this ); +// customDirMenu = new QPopupMenu( this ); layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); menuBar->insertItem( tr( "File" ), fileMenu); menuBar->insertItem( tr( "View" ), viewMenu); +// menuBar->insertItem( tr( "^" ), customDirMenu); + + cdUpButton = new QToolButton( this,"cdUpButton"); + cdUpButton->setPixmap(Resource::loadPixmap("up")); + cdUpButton->setFixedSize( QSize( 20, 20 ) ); + layout->addMultiCellWidget( cdUpButton , 0, 0, 2, 2); + + menuButton = new MenuButton(this); + menuButton->setFixedSize( QSize( 20, 20 ) ); + layout->addMultiCellWidget( menuButton , 0, 0, 3, 3); qpeDirButton= new QToolButton(this,"QPEButton"); qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); - layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); + layout->addMultiCellWidget( qpeDirButton , 0, 0, 4, 4); cfButton = new QToolButton( this,"CFButton"); cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); cfButton ->setFixedSize( QSize( 20, 20 ) ); - layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); + layout->addMultiCellWidget( cfButton , 0, 0, 5, 5); sdButton = new QToolButton( this,"SDButton"); sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard")); sdButton->setFixedSize( QSize( 20, 20 ) ); - layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); + layout->addMultiCellWidget( sdButton , 0, 0, 6, 6); - cdUpButton = new QToolButton( this,"cdUpButton"); - cdUpButton->setPixmap(Resource::loadPixmap("up")); - cdUpButton ->setFixedSize( QSize( 20, 20 ) ); - layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); docButton = new QToolButton( this,"docsButton"); docButton->setPixmap(Resource::loadPixmap("DocsIcon")); docButton->setFixedSize( QSize( 20, 20 ) ); - layout->addMultiCellWidget( docButton, 0, 0, 6, 6); + layout->addMultiCellWidget( docButton, 0, 0, 7, 7); homeButton = new QToolButton( this,"homeButton"); homeButton->setPixmap(Resource::loadPixmap("home")); homeButton->setFixedSize( QSize( 20, 20 ) ); - layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); + layout->addMultiCellWidget( homeButton, 0, 0, 8, 8); fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 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() )); fileMenu->insertSeparator(); fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); fileMenu->setCheckable(TRUE); viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); viewMenu->insertSeparator(); viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); viewMenu->setCheckable(TRUE); + s_addBookmark = tr("Bookmark Directory"); + s_removeBookmark = tr("Remove Current Directory from Bookmarks"); + + menuButton->setUseLabel(false); + menuButton->insertItem( s_addBookmark); + menuButton->insertItem( s_removeBookmark); + menuButton->insertSeparator(); +// menuButton->insertItem(""); + +// customDirMenu->insertItem(tr("Add This Directory")); +// customDirMenu->insertItem(tr("Remove This Directory")); +// customDirMenu->insertSeparator(); + + customDirsToMenu(); currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); currentPathCombo->setEditable(TRUE); - layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); + layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 8); currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); - layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); + layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 8); TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); // TabWidget = new QTabWidget( this, "TabWidget" ); - layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); + layout->addMultiCellWidget( TabWidget, 2, 2, 0, 8); tab = new QWidget( TabWidget, "tab" ); tabLayout = new QGridLayout( tab ); tabLayout->setSpacing( 2); tabLayout->setMargin( 2); Local_View = new QListView( tab, "Local_View" ); Local_View->addColumn( tr("File"),130); Local_View->addColumn( tr("Size"),-1); Local_View->setColumnAlignment(1,QListView::AlignRight); 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); @@ -201,41 +224,46 @@ void AdvancedFm::init() { b = TRUE; filterStr="*"; b=FALSE; TabWidget->setCurrentTab(0); } void AdvancedFm::initConnections() { connect( qApp,SIGNAL( aboutToQuit()),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( 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( localListClicked(QListViewItem *)) ); connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); connect( Remote_View, SIGNAL( clicked( QListViewItem*)), this,SLOT( remoteListClicked(QListViewItem *)) ); connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); - connect(TabWidget,SIGNAL(currentChanged(QWidget *)), + connect( TabWidget,SIGNAL(currentChanged(QWidget *)), this,SLOT(tabChanged(QWidget*))); connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); + connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); +// connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); + +// connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); + } |