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 /noncore | |
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 | 88 | ||||
-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 | 20 |
4 files changed, 71 insertions, 42 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 @@ -7,16 +7,17 @@ * 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 <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> #include <qcombobox.h> @@ -37,23 +38,31 @@ using namespace Opie::Ui; AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) : 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&)) ); + initConnections(); + + whichTab = 1; + 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() { } void AdvancedFm::cleanUp() { QString sfile=QDir::homeDirPath(); @@ -61,46 +70,55 @@ void AdvancedFm::cleanUp() { 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(); +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); setCaption(tr("AdvancedFm :: ")+fs+" :: " +checkDiskSpace((const QString &) path)+ tr(" kB free") ); @@ -210,18 +228,23 @@ 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) { + 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; QString strItem2; if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink @@ -241,37 +264,39 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) { populateView(); CurrentView()->ensureItemVisible( CurrentView()->firstChild()); } 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"); } @@ -285,17 +310,18 @@ void AdvancedFm::currentPathComboChanged() { populateView(); } else { 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); } } else { currentPathCombo->lineEdit()->setText( currentPath); @@ -752,50 +778,59 @@ void AdvancedFm::gotoCustomDir(const QString &dir) { // thisDir->cd( curDir, TRUE); // populateView(); // } } } 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; } } QListView * AdvancedFm::OtherView() { if ( whichTab == 1) 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(); OtherView()->setSelected( CurrentView()->firstChild(), true); } @@ -812,17 +847,17 @@ 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); populateView(); } @@ -852,21 +887,12 @@ 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 @@ -124,19 +124,19 @@ protected: 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 homeButtonPushed(); void docButtonPushed(); void SDButtonPushed(); void CFButtonPushed(); void QPEButtonPushed(); @@ -151,16 +151,17 @@ protected slots: 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; void startProcess(const QString &); bool eventFilter( QObject * , QEvent * ); void cancelRename(); 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 @@ -1,15 +1,15 @@ 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 } include ( $(OPIEDIR)/include.pro ) 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 @@ -329,17 +329,16 @@ void AdvancedFm::copy() { } } setOtherTabCurrent(); rePopulate(); } } void AdvancedFm::copyAs() { - qApp->processEvents(); QStringList curFileList = getPath(); QString curFile, item; InputDialog *fileDlg; QDir *thisDir = CurrentDir(); QDir *thatDir = OtherDir(); @@ -373,18 +372,20 @@ void AdvancedFm::copyAs() { QMessageBox::message("AdvancedFm",tr("Could not copy\n") +curFile +tr("to\n")+destFile); return; } } delete fileDlg; } - rePopulate(); - setOtherTabCurrent(); + rePopulate(); + setOtherTabCurrent(); + qApp->processEvents(); + } void AdvancedFm::copySameDir() { qApp->processEvents(); QStringList curFileList = getPath(); QString curFile, item, destFile; InputDialog *fileDlg; @@ -748,22 +749,23 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { } else if ( e->type() == QEvent::FocusOut ) { cancelRename(); return true; } } if ( o->inherits( "QListView" ) ) { if ( e->type() == QEvent::FocusIn ) { - if( o == Local_View) { //keep track of which view - whichTab=1; - } - else { - whichTab=2; - } + if( o == Local_View) { //keep track of which view + qDebug("local view"); + whichTab = 1; + } else { + whichTab = 2; + qDebug("remote view"); + } } OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection } return QWidget::eventFilter( o, e ); } |