author | llornkcor <llornkcor> | 2004-09-18 09:05:57 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-18 09:05:57 (UTC) |
commit | eaf09b9b6e1abbe36e814a8e4da315ac8d96bd63 (patch) (side-by-side diff) | |
tree | ee914747ae2494d50716ab3cda866613d4eb134c | |
parent | 5096f9bd9f1a06e5238e2206eee195c43a2bdb6b (diff) | |
download | opie-eaf09b9b6e1abbe36e814a8e4da315ac8d96bd63.zip opie-eaf09b9b6e1abbe36e814a8e4da315ac8d96bd63.tar.gz opie-eaf09b9b6e1abbe36e814a8e4da315ac8d96bd63.tar.bz2 |
fix stuff, including #1404
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 74 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 3 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.pro | 2 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 8 |
4 files changed, 58 insertions, 29 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index afb44f5..b4461cb 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -9,12 +9,13 @@ * 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 <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/mimetype.h> #include <qpe/applnk.h> #include <qpe/resource.h> #include <qpe/menubutton.h> @@ -40,18 +41,26 @@ AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) init(); renameBox = 0; unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); initConnections(); + whichTab=1; - rePopulate(); - currentPathCombo->setFocus(); + populateView(); +// 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&)) ); + +// if( CurrentView() == Local_View) +// qDebug("LOCAL VIEW"); +// else +// qDebug("REMOTE VIEW"); + switchToLocalTab(); } AdvancedFm::~AdvancedFm() { } @@ -63,42 +72,51 @@ void AdvancedFm::cleanUp() { sfile+="._temp"; QFile file( sfile); if(file.exists()) file.remove(); } -void AdvancedFm::tabChanged(QWidget *) { -// owarn << "tab changed" << oendl; +void AdvancedFm::tabChanged(QWidget *wd) { + if(wd == tab) + odebug << "LOCAL VIEW SHOWN"<< oendl; + else if(wd == tab_2) + odebug<< "REMOTE VIEW SHOWN"<< oendl; + QString path = CurrentDir()->canonicalPath(); currentPathCombo->lineEdit()->setText( path ); - if(whichTab == 1) { + if ( TabWidget->currentWidget() == tab) { +// 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()); + if( wd == Local_View) { + Remote_View->clearFocus(); + } else { + Local_View->clearFocus(); + } + } void AdvancedFm::populateView() { -// owarn << "PopulateView" << oendl; QPixmap pm; QListView *thisView = CurrentView(); QDir *thisDir = CurrentDir(); QString path = thisDir->canonicalPath(); -//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); @@ -212,13 +230,18 @@ void AdvancedFm::rePopulate() { // populateView(); // } // TabWidget->setCurrentWidget( tmpTab - 1); } void AdvancedFm::ListClicked(QListViewItem *selectedItem) { -//owarn << "listclicked" << oendl; + if ( TabWidget->currentWidget() == tab) + qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local"); + else + qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote"); + + if(selectedItem) { QString strItem=selectedItem->text(0); // owarn << strItem << oendl; QString strSize=selectedItem->text(1); strSize=strSize.stripWhiteSpace(); bool isDirectory = false; @@ -243,33 +266,35 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) { } chdir( strItem.latin1()); } } void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { - dealWithSchmooSchmaa( item->listView()); + Q_UNUSED(item); switch (mouse) { case 1: { if(renameBox != 0 ) { cancelRename(); } } break; +// case 2: +// menuTimer.start( 50, 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"); @@ -287,13 +312,14 @@ void AdvancedFm::currentPathComboChanged() { QMessageBox::message(tr("Note"),tr("That directory does not exist")); } } void AdvancedFm::fillCombo(const QString ¤tPath) { - if ( whichTab == 1) { + if ( TabWidget->currentWidget() == tab) { +// if ( whichTab == 1) { currentPathCombo->lineEdit()->setText( currentPath); if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { currentPathCombo->clear(); localDirPathStringList.prepend( currentPath ); currentPathCombo->insertStringList( localDirPathStringList,-1); } @@ -754,30 +780,39 @@ void AdvancedFm::gotoCustomDir(const QString &dir) { // } } } QDir *AdvancedFm::CurrentDir() { + if ( TabWidget->currentWidget() == tab) + qDebug("CurrentTab is Local"); + else + qDebug("CurrentTab is Remote"); + if ( whichTab == 1) { return ¤tDir; } else { return ¤tRemoteDir; } } QDir *AdvancedFm::OtherDir() { +// if ( TabWidget->currentWidget() == tab) { if ( whichTab == 1) { return ¤tRemoteDir; } else { return ¤tDir; } } QListView * AdvancedFm::CurrentView() { + if ( TabWidget->currentWidget() == tab) + odebug << "CurrentView local" << oendl; + +// if ( TabWidget->currentWidget() == tab) { if ( whichTab == 1) { -// owarn << "CurrentView Tab 1" << oendl; return Local_View; } else { // owarn << "CurrentView Tab 2" << oendl; return Remote_View; } } @@ -787,13 +822,13 @@ QListView * AdvancedFm::OtherView() { return Remote_View; else return Local_View; } void AdvancedFm::setOtherTabCurrent() { -// owarn << "setOtherTabCurrent() " << whichTab << "" << oendl; + qDebug("setOtherTabCurrent() %d",whichTab); if ( whichTab == 1) { TabWidget->setCurrentWidget(1); } else { TabWidget->setCurrentWidget(0); } OtherView()->setFocus(); @@ -814,13 +849,13 @@ void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { void AdvancedFm::setDocument(const QString &file) { gotoDirectory( file); } void AdvancedFm::gotoDirectory(const QString &file) { -// owarn << "goto dir "+file << oendl; + qDebug("goto dir "+file); QString curDir = file; QDir *thisDir = CurrentDir(); if(QDir( curDir).exists() ) { thisDir->setPath( curDir ); chdir( curDir.latin1() ); thisDir->cd( curDir, TRUE); @@ -854,19 +889,10 @@ void AdvancedFm::findFile(const QString &fileName) { void AdvancedFm::slotSwitchMenu(int ) { // odebug << "Switch " << item << "" << oendl; // viewMenu->setItemChecked(item, true); } -void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) { - tabChanged( w); - if( w == Local_View) { - Remote_View->clearFocus(); - } else { - Local_View->clearFocus(); - } -} - void AdvancedFm::navigateToSelected() { if( !CurrentView()->currentItem()) return; doDirChange(); } diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index effda0b..e596977 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h @@ -126,15 +126,15 @@ protected: 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 homeButtonPushed(); void docButtonPushed(); void SDButtonPushed(); @@ -153,12 +153,13 @@ protected slots: 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; void startProcess(const QString &); diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro index f1c518e..0644edb 100644 --- a/noncore/apps/advancedfm/advancedfm.pro +++ b/noncore/apps/advancedfm/advancedfm.pro @@ -2,13 +2,13 @@ TEMPLATE = app CONFIG += qt warn_on quick-app HEADERS = advancedfm.h filePermissions.h output.h SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp TARGET = advancedfm INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopiecore2 -lopieui2 +LIBS += -lqpe -lqte -lopiecore2 -lopieui2 !contains(CONFIG,quick-app) { DESTDIR = $(OPIEDIR)/bin DEFINES += NOQUICKLAUNCH } diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 4628170..8d04c68 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -331,13 +331,12 @@ void AdvancedFm::copy() { setOtherTabCurrent(); rePopulate(); } } void AdvancedFm::copyAs() { - qApp->processEvents(); QStringList curFileList = getPath(); QString curFile, item; InputDialog *fileDlg; QDir *thisDir = CurrentDir(); @@ -377,12 +376,14 @@ void AdvancedFm::copyAs() { } delete fileDlg; } rePopulate(); setOtherTabCurrent(); + qApp->processEvents(); + } void AdvancedFm::copySameDir() { qApp->processEvents(); QStringList curFileList = getPath(); QString curFile, item, destFile; @@ -751,16 +752,17 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { return true; } } if ( o->inherits( "QListView" ) ) { if ( e->type() == QEvent::FocusIn ) { if( o == Local_View) { //keep track of which view + qDebug("local view"); whichTab=1; - } - else { + } else { whichTab=2; + qDebug("remote view"); } } OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection } return QWidget::eventFilter( o, e ); |