summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfm.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp88
1 files changed, 57 insertions, 31 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 &currentPath) {
- 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 &currentDir;
} else {
return &currentRemoteDir;
}
}
QDir *AdvancedFm::OtherDir() {
+// if ( TabWidget->currentWidget() == tab) {
if ( whichTab == 1) {
return &currentRemoteDir;
} else {
return &currentDir;
}
}
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();
}