From 0535df00106c4e4c78e6ae8dde8f4f41f8487dae Mon Sep 17 00:00:00 2001 From: llornkcor Date: Sun, 20 Oct 2002 15:51:08 +0000 Subject: converted to otab, and updated show hidden dir functions --- (limited to 'noncore') diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index f23fd86..08dc24e 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -12,6 +12,7 @@ #define DEVELOPERS_VERSION #include "advancedfm.h" + #include // #include // #include @@ -87,7 +88,8 @@ void AdvancedFm::cleanUp() { } void AdvancedFm::tabChanged(QWidget *) { - if (TabWidget->currentPageIndex() == 0) { + 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); @@ -96,7 +98,9 @@ void AdvancedFm::tabChanged(QWidget *) { +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); } - if (TabWidget->currentPageIndex() == 1) { + if (TabWidget->getCurrentTab() == 1) { + +// if (TabWidget->currentPageIndex() == 1) { currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); @@ -414,12 +418,12 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, in void AdvancedFm::switchToLocalTab() { - TabWidget->setCurrentPage(0); + TabWidget->setCurrentTab(0); Local_View->setFocus(); } void AdvancedFm::switchToRemoteTab() { - TabWidget->setCurrentPage(1); + TabWidget->setCurrentTab(1); Remote_View->setFocus(); } @@ -432,7 +436,8 @@ void AdvancedFm::writeConfig() { } void AdvancedFm::currentPathComboChanged() { - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { +// if (TabWidget->currentPageIndex() == 0) { if(QDir( currentPathCombo->lineEdit()->text()).exists()) { currentDir.setPath( currentPathCombo->lineEdit()->text() ); populateLocalView(); @@ -440,7 +445,8 @@ void AdvancedFm::currentPathComboChanged() { QMessageBox::message(tr("Note"),tr("That directory does not exist")); } } - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { +// if (TabWidget->currentPageIndex() == 0) { if(QDir( currentPathCombo->lineEdit()->text()).exists()) { currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); populateRemoteView(); @@ -452,7 +458,8 @@ void AdvancedFm::currentPathComboChanged() { void AdvancedFm::fillCombo(const QString ¤tPath) { - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { +// if (TabWidget->currentPageIndex() == 0) { currentPathCombo->lineEdit()->setText( currentPath); if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { currentPathCombo->clear(); @@ -470,7 +477,8 @@ void AdvancedFm::fillCombo(const QString ¤tPath) { } void AdvancedFm::currentPathComboActivated(const QString & currentPath) { - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { +// if (TabWidget->currentPageIndex() == 0) { chdir( currentPath.latin1() ); currentDir.cd( currentPath, TRUE); populateLocalView(); @@ -485,7 +493,8 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath) { QStringList AdvancedFm::getPath() { QStringList strList; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { +// if (TabWidget->currentPageIndex() == 0) { QList * getSelectedItems( QListView * Local_View ); QListViewItemIterator it( Local_View ); for ( ; it.current(); ++it ) { @@ -512,7 +521,8 @@ QStringList AdvancedFm::getPath() { void AdvancedFm::homeButtonPushed() { QString current = QDir::homeDirPath(); chdir( current.latin1() ); - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { +// if (TabWidget->currentPageIndex() == 0) { currentDir.cd( current, TRUE); populateLocalView(); } else { @@ -525,7 +535,9 @@ void AdvancedFm::homeButtonPushed() { void AdvancedFm::docButtonPushed() { QString current = QPEApplication::documentDir(); chdir( current.latin1() ); - if (TabWidget->currentPageIndex() == 0) { + + if (TabWidget->getCurrentTab() == 0) { +//if (TabWidget->currentPageIndex() == 0) { currentDir.cd( current, TRUE); populateLocalView(); } else { @@ -538,7 +550,8 @@ void AdvancedFm::docButtonPushed() { void AdvancedFm::SDButtonPushed() { QString current = "/mnt/card";// this can change so fix chdir( current.latin1() ); - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { +// if (TabWidget->currentPageIndex() == 0) { currentDir.cd( current, TRUE); populateLocalView(); } else { @@ -557,7 +570,8 @@ void AdvancedFm::CFButtonPushed() { current = "/mnt/hda"; //ipaq chdir( current.latin1() ); - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { +// if (TabWidget->currentPageIndex() == 0) { currentDir.cd( current, TRUE); populateLocalView(); } else { @@ -645,7 +659,8 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { void AdvancedFm::QPEButtonPushed() { QString current = QPEApplication::qpeDir(); chdir( current.latin1() ); - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { +// if (TabWidget->currentPageIndex() == 0) { currentDir.cd( current, TRUE); populateLocalView(); } else { @@ -717,7 +732,8 @@ void AdvancedFm::showFileMenu() { QString curApp; bool isLocalView = false; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { +// if (TabWidget->currentPageIndex() == 0) { isLocalView = TRUE; curApp = Local_View->currentItem()->text(0); } else { @@ -730,8 +746,11 @@ void AdvancedFm::showFileMenu() { QPopupMenu *m = new QPopupMenu(0); QPopupMenu *n = new QPopupMenu(0); // QPopupMenu *o = new QPopupMenu(0); - m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); - + if (TabWidget->getCurrentTab() == 0) + m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); + else + m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); + if ( QFileInfo(fi).isDir() ) { m->insertSeparator(); m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); @@ -829,7 +848,8 @@ void AdvancedFm::addToDocs() { QStringList strListPaths = getPath(); if( strListPaths.count() > 0) { QString curFile; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { +// if (TabWidget->currentPageIndex() == 0) { for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { curFile = currentDir.canonicalPath()+"/"+(*it); qDebug(curFile); diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index f846c66..12ebbf2 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h @@ -14,6 +14,7 @@ #define QTOPIA_INTERNAL_FSLP // to get access to fileproperties #define QT_QWS_OPIE +//#include #include #include @@ -25,6 +26,7 @@ #include #include +class OTabWidget; class QVBoxLayout; class QHBoxLayout; class QGridLayout; @@ -53,7 +55,8 @@ public: AdvancedFm(); ~AdvancedFm(); - QTabWidget *TabWidget; + OTabWidget *TabWidget; +// QTabWidget *TabWidget; QWidget *tab, *tab_2, *tab_3; QListView *Local_View, *Remote_View; diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro index eb4f122..3896f50 100644 --- a/noncore/apps/advancedfm/advancedfm.pro +++ b/noncore/apps/advancedfm/advancedfm.pro @@ -7,7 +7,7 @@ REQUIRES=medium-config INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/bin -LIBS += -lqpe +LIBS += -lqpe -lopie TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ ../../../i18n/en/advancedfm.ts \ diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 619a7a9..7188640 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp @@ -11,6 +11,7 @@ ***************************************************************************/ #include "advancedfm.h" +#include #include #include #include @@ -22,7 +23,6 @@ #include #include #include -#include #include #include @@ -108,7 +108,8 @@ void AdvancedFm::init() { layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); - TabWidget = new QTabWidget( this, "TabWidget" ); + TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab); +// TabWidget = new QTabWidget( this, "TabWidget" ); layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); tab = new QWidget( TabWidget, "tab" ); @@ -130,7 +131,8 @@ void AdvancedFm::init() { tabLayout->addWidget( Local_View, 0, 0 ); - TabWidget->insertTab( tab, tr("1")); + TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1")); +// TabWidget->insertTab( tab, tr("1")); tab_2 = new QWidget( TabWidget, "tab_2" ); tabLayout_2 = new QGridLayout( tab_2 ); @@ -152,8 +154,8 @@ void AdvancedFm::init() { tabLayout_2->addWidget( Remote_View, 0, 0 ); - - TabWidget->insertTab( tab_2, tr( "2")); + TabWidget->addTab( tab_2, "advancedfm/smFileBrowser.png",tr( "2")); +// TabWidget->insertTab( tab_2, tr( "2")); /* tab_3 = new QWidget( TabWidget, "tab_3" ); tabLayout_3 = new QGridLayout( tab_3 ); @@ -199,7 +201,7 @@ void AdvancedFm::init() { filterStr="*"; b=FALSE; - + TabWidget->setCurrentTab(0); } diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 5fa8d0c..27a119f 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -14,6 +14,8 @@ #include "output.h" #include "filePermissions.h" +#include + #include #include #include @@ -53,10 +55,24 @@ void AdvancedFm::doRemoteCd() { } void AdvancedFm::showMenuHidden() { - if(TabWidget->currentPageIndex() == 0) - showHidden(); - else - showRemoteHidden(); + if (b) { + currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); +// b=FALSE; + + } else { + currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); +// b=TRUE; + } + populateLocalView(); + populateRemoteView(); +// if(TabWidget->getCurrentTab() == 0) +// showHidden(); +// else +// showRemoteHidden(); // if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); if(b) b = false; else b = true; } @@ -64,12 +80,12 @@ void AdvancedFm::showMenuHidden() { void AdvancedFm::showHidden() { if (b) { currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); - fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); +// fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); // b=FALSE; } else { currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); - fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); +// fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); // b=TRUE; } populateLocalView(); @@ -89,7 +105,7 @@ void AdvancedFm::showRemoteHidden() { void AdvancedFm::runThis() { QString fs; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { QString curFile = Local_View->currentItem()->text(0); if(curFile != "../") { @@ -141,7 +157,7 @@ void AdvancedFm::runThis() { } void AdvancedFm::runText() { - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { QString curFile = Local_View->currentItem()->text(0); if(curFile != "../") { curFile = currentDir.canonicalPath()+"/"+curFile; @@ -323,7 +339,7 @@ void AdvancedFm::filePerms() { QStringList curFileList = getPath(); QString filePath; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { filePath = currentDir.canonicalPath()+"/"; } else { filePath= currentRemoteDir.canonicalPath()+"/"; @@ -337,7 +353,7 @@ void AdvancedFm::filePerms() { if( filePerm) delete filePerm; } - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { populateLocalView(); } else { populateRemoteView(); @@ -350,7 +366,7 @@ void AdvancedFm::doProperties() { QStringList curFileList = getPath(); QString filePath; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { filePath = currentDir.canonicalPath()+"/"; } else { filePath= currentRemoteDir.canonicalPath()+"/"; @@ -369,7 +385,7 @@ void AdvancedFm::doProperties() { } void AdvancedFm::upDir() { - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { QString current = currentDir.canonicalPath(); QDir dir(current); dir.cdUp(); @@ -395,7 +411,7 @@ void AdvancedFm::copy() { QStringList curFileList = getPath(); if( curFileList.count() > 0) { QString curFile, item, destFile; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { item=(*it); @@ -427,7 +443,7 @@ void AdvancedFm::copy() { } } populateRemoteView(); - TabWidget->setCurrentPage(1); + TabWidget->setCurrentTab(1); } else { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { @@ -463,7 +479,7 @@ void AdvancedFm::copy() { } } populateLocalView(); - TabWidget->setCurrentPage(0); + TabWidget->setCurrentTab(0); } } @@ -475,7 +491,7 @@ void AdvancedFm::copyAs() { QStringList curFileList = getPath(); QString curFile; InputDialog *fileDlg; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { qDebug("tab 1"); for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { QString destFile; @@ -512,7 +528,7 @@ void AdvancedFm::copyAs() { } populateRemoteView(); - TabWidget->setCurrentPage(1); + TabWidget->setCurrentTab(1); } else { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { @@ -552,7 +568,7 @@ void AdvancedFm::copyAs() { } populateLocalView(); - TabWidget->setCurrentPage(0); + TabWidget->setCurrentTab(0); } } @@ -562,7 +578,7 @@ void AdvancedFm::copySameDir() { QString curFile, item, destFile; InputDialog *fileDlg; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { item=(*it); @@ -649,7 +665,7 @@ void AdvancedFm::move() { if( curFileList.count() > 0) { QString curFile, destFile, item; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { item=(*it); @@ -678,7 +694,7 @@ void AdvancedFm::move() { } } - TabWidget->setCurrentPage(1); + TabWidget->setCurrentTab(1); } else { //view 2 @@ -708,7 +724,7 @@ void AdvancedFm::move() { } else QFile::remove( curFile); } - TabWidget->setCurrentPage(0); + TabWidget->setCurrentTab(0); } } populateRemoteView(); @@ -749,7 +765,7 @@ bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { void AdvancedFm::runCommand() { QString curFile; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { if( Local_View->currentItem()) curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); } else { @@ -795,7 +811,7 @@ void AdvancedFm::runCommand() { void AdvancedFm::runCommandStd() { QString curFile; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { if( Local_View->currentItem()) curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); } else { @@ -818,7 +834,7 @@ void AdvancedFm::runCommandStd() { void AdvancedFm::fileStatus() { QString curFile; - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { curFile = Local_View->currentItem()->text(0); } else { curFile = Remote_View->currentItem()->text(0); @@ -850,7 +866,7 @@ void AdvancedFm::fileStatus() { } void AdvancedFm::mkDir() { - if (TabWidget->currentPageIndex() == 0) + if (TabWidget->getCurrentTab() == 0) localMakDir(); else remoteMakDir(); @@ -858,7 +874,7 @@ void AdvancedFm::mkDir() { } void AdvancedFm::rn() { - if (TabWidget->currentPageIndex() == 0) + if (TabWidget->getCurrentTab() == 0) localRename(); else remoteRename(); @@ -866,7 +882,7 @@ void AdvancedFm::rn() { } void AdvancedFm::del() { - if (TabWidget->currentPageIndex() == 0) + if (TabWidget->getCurrentTab() == 0) localDelete(); else remoteDelete(); @@ -877,7 +893,7 @@ void AdvancedFm::mkSym() { QStringList curFileList = getPath(); if( curFileList.count() > 0) { - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); @@ -889,7 +905,7 @@ void AdvancedFm::mkSym() { system(cmd.latin1() ); } populateRemoteView(); - TabWidget->setCurrentPage(1); + TabWidget->setCurrentTab(1); } else { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { @@ -903,7 +919,7 @@ void AdvancedFm::mkSym() { system(cmd.latin1() ); } populateLocalView(); - TabWidget->setCurrentPage(0); + TabWidget->setCurrentTab(0); } } } @@ -916,7 +932,7 @@ void AdvancedFm::doBeam() { QStringList curFileList = getPath(); if( curFileList.count() > 0) { - if (TabWidget->currentPageIndex() == 0) { + if (TabWidget->getCurrentTab() == 0) { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { QString curFile = currentDir.canonicalPath()+"/"+(*it); -- cgit v0.9.0.2