summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfm.cpp
Unidiff
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
@@ -12,6 +12,7 @@
12#define DEVELOPERS_VERSION 12#define DEVELOPERS_VERSION
13#include "advancedfm.h" 13#include "advancedfm.h"
14 14
15#include <opie2/odebug.h>
15#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
16#include <qpe/config.h> 17#include <qpe/config.h>
17#include <qpe/mimetype.h> 18#include <qpe/mimetype.h>
@@ -42,13 +43,21 @@ AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
42 43
43 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 44 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
44 45
45 initConnections(); 46 initConnections();
46 whichTab=1; 47
47 rePopulate(); 48 whichTab = 1;
48 currentPathCombo->setFocus(); 49 populateView();
49 channel = new QCopChannel( "QPE/Application/advancedfm", this ); 50 // rePopulate();
50 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 51 // currentPathCombo->setFocus();
51 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); 52 channel = new QCopChannel( "QPE/Application/advancedfm", this );
53 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
54 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) );
55
56 // if( CurrentView() == Local_View)
57 // qDebug("LOCAL VIEW");
58 // else
59 // qDebug("REMOTE VIEW");
60 switchToLocalTab();
52} 61}
53 62
54AdvancedFm::~AdvancedFm() { 63AdvancedFm::~AdvancedFm() {
@@ -66,12 +75,17 @@ void AdvancedFm::cleanUp() {
66 file.remove(); 75 file.remove();
67} 76}
68 77
69void AdvancedFm::tabChanged(QWidget *) { 78void AdvancedFm::tabChanged(QWidget *wd) {
70// owarn << "tab changed" << oendl; 79 if(wd == tab)
71 QString path = CurrentDir()->canonicalPath(); 80 odebug << "LOCAL VIEW SHOWN"<< oendl;
81 else if(wd == tab_2)
82 odebug<< "REMOTE VIEW SHOWN"<< oendl;
83
84 QString path = CurrentDir()->canonicalPath();
72 currentPathCombo->lineEdit()->setText( path ); 85 currentPathCombo->lineEdit()->setText( path );
73 86
74 if(whichTab == 1) { 87 if ( TabWidget->currentWidget() == tab) {
88// if(whichTab == 1) {
75 viewMenu->setItemChecked(viewMenu->idAt(0), true); 89 viewMenu->setItemChecked(viewMenu->idAt(0), true);
76 viewMenu->setItemChecked(viewMenu->idAt(1), false); 90 viewMenu->setItemChecked(viewMenu->idAt(1), false);
77 } else { 91 } else {
@@ -84,18 +98,22 @@ void AdvancedFm::tabChanged(QWidget *) {
84 setCaption(tr("AdvancedFm :: ")+fs+" :: " 98 setCaption(tr("AdvancedFm :: ")+fs+" :: "
85 +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); 99 +checkDiskSpace( (const QString &) path )+ tr(" kB free") );
86 chdir( path.latin1()); 100 chdir( path.latin1());
101 if( wd == Local_View) {
102 Remote_View->clearFocus();
103 } else {
104 Local_View->clearFocus();
105 }
106
87} 107}
88 108
89 109
90void AdvancedFm::populateView() { 110void AdvancedFm::populateView() {
91 111
92// owarn << "PopulateView" << oendl;
93 QPixmap pm; 112 QPixmap pm;
94 QListView *thisView = CurrentView(); 113 QListView *thisView = CurrentView();
95 QDir *thisDir = CurrentDir(); 114 QDir *thisDir = CurrentDir();
96 QString path = thisDir->canonicalPath(); 115 QString path = thisDir->canonicalPath();
97 116
98//owarn << "path is "+path << oendl;
99 thisView->clear(); 117 thisView->clear();
100 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 118 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
101 thisDir->setMatchAllDirs(TRUE); 119 thisDir->setMatchAllDirs(TRUE);
@@ -215,8 +233,13 @@ void AdvancedFm::rePopulate() {
215} 233}
216 234
217void AdvancedFm::ListClicked(QListViewItem *selectedItem) { 235void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
218//owarn << "listclicked" << oendl; 236 if ( TabWidget->currentWidget() == tab)
219 if(selectedItem) { 237 qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local");
238 else
239 qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote");
240
241
242 if(selectedItem) {
220 QString strItem=selectedItem->text(0); 243 QString strItem=selectedItem->text(0);
221// owarn << strItem << oendl; 244// owarn << strItem << oendl;
222 QString strSize=selectedItem->text(1); 245 QString strSize=selectedItem->text(1);
@@ -246,7 +269,7 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
246} 269}
247 270
248void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { 271void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) {
249 dealWithSchmooSchmaa( item->listView()); 272 Q_UNUSED(item);
250 switch (mouse) { 273 switch (mouse) {
251 case 1: 274 case 1:
252 { 275 {
@@ -255,18 +278,20 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , in
255 } 278 }
256 } 279 }
257 break; 280 break;
281// case 2:
282// menuTimer.start( 50, TRUE );
283// break;
258 }; 284 };
259} 285}
260 286
261 287
262void AdvancedFm::switchToLocalTab() { 288void AdvancedFm::switchToLocalTab() {
263//owarn << "switch to local view" << oendl;
264 TabWidget->setCurrentWidget(0); 289 TabWidget->setCurrentWidget(0);
265 Local_View->setFocus(); 290 Local_View->setFocus();
291
266} 292}
267 293
268void AdvancedFm::switchToRemoteTab() { 294void AdvancedFm::switchToRemoteTab() {
269//owarn << "switch to local view" << oendl;
270 TabWidget->setCurrentWidget(1); 295 TabWidget->setCurrentWidget(1);
271 Remote_View->setFocus(); 296 Remote_View->setFocus();
272} 297}
@@ -290,7 +315,8 @@ void AdvancedFm::currentPathComboChanged() {
290 315
291void AdvancedFm::fillCombo(const QString &currentPath) { 316void AdvancedFm::fillCombo(const QString &currentPath) {
292 317
293 if ( whichTab == 1) { 318 if ( TabWidget->currentWidget() == tab) {
319// if ( whichTab == 1) {
294 currentPathCombo->lineEdit()->setText( currentPath); 320 currentPathCombo->lineEdit()->setText( currentPath);
295 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 321 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
296 currentPathCombo->clear(); 322 currentPathCombo->clear();
@@ -757,6 +783,11 @@ void AdvancedFm::gotoCustomDir(const QString &dir) {
757 783
758QDir *AdvancedFm::CurrentDir() { 784QDir *AdvancedFm::CurrentDir() {
759 785
786 if ( TabWidget->currentWidget() == tab)
787 qDebug("CurrentTab is Local");
788 else
789 qDebug("CurrentTab is Remote");
790
760 if ( whichTab == 1) { 791 if ( whichTab == 1) {
761 return &currentDir; 792 return &currentDir;
762 } else { 793 } else {
@@ -765,6 +796,7 @@ QDir *AdvancedFm::CurrentDir() {
765} 796}
766 797
767QDir *AdvancedFm::OtherDir() { 798QDir *AdvancedFm::OtherDir() {
799 // if ( TabWidget->currentWidget() == tab) {
768 if ( whichTab == 1) { 800 if ( whichTab == 1) {
769 return &currentRemoteDir; 801 return &currentRemoteDir;
770 } else { 802 } else {
@@ -773,8 +805,11 @@ QDir *AdvancedFm::OtherDir() {
773} 805}
774 806
775QListView * AdvancedFm::CurrentView() { 807QListView * AdvancedFm::CurrentView() {
808 if ( TabWidget->currentWidget() == tab)
809 odebug << "CurrentView local" << oendl;
810
811 // if ( TabWidget->currentWidget() == tab) {
776 if ( whichTab == 1) { 812 if ( whichTab == 1) {
777// owarn << "CurrentView Tab 1" << oendl;
778 return Local_View; 813 return Local_View;
779 } else { 814 } else {
780// owarn << "CurrentView Tab 2" << oendl; 815// owarn << "CurrentView Tab 2" << oendl;
@@ -790,7 +825,7 @@ QListView * AdvancedFm::OtherView() {
790} 825}
791 826
792void AdvancedFm::setOtherTabCurrent() { 827void AdvancedFm::setOtherTabCurrent() {
793// owarn << "setOtherTabCurrent() " << whichTab << "" << oendl; 828 qDebug("setOtherTabCurrent() %d",whichTab);
794 if ( whichTab == 1) { 829 if ( whichTab == 1) {
795 TabWidget->setCurrentWidget(1); 830 TabWidget->setCurrentWidget(1);
796 } else { 831 } else {
@@ -817,7 +852,7 @@ void AdvancedFm::setDocument(const QString &file) {
817} 852}
818 853
819void AdvancedFm::gotoDirectory(const QString &file) { 854void AdvancedFm::gotoDirectory(const QString &file) {
820// owarn << "goto dir "+file << oendl; 855 qDebug("goto dir "+file);
821 QString curDir = file; 856 QString curDir = file;
822 QDir *thisDir = CurrentDir(); 857 QDir *thisDir = CurrentDir();
823 if(QDir( curDir).exists() ) { 858 if(QDir( curDir).exists() ) {
@@ -857,15 +892,6 @@ void AdvancedFm::slotSwitchMenu(int ) {
857 // viewMenu->setItemChecked(item, true); 892 // viewMenu->setItemChecked(item, true);
858} 893}
859 894
860void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) {
861 tabChanged( w);
862 if( w == Local_View) {
863 Remote_View->clearFocus();
864 } else {
865 Local_View->clearFocus();
866 }
867}
868
869void AdvancedFm::navigateToSelected() { 895void AdvancedFm::navigateToSelected() {
870 if( !CurrentView()->currentItem()) return; 896 if( !CurrentView()->currentItem()) return;
871 doDirChange(); 897 doDirChange();