summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-09-25 04:28:01 (UTC)
committer llornkcor <llornkcor>2004-09-25 04:28:01 (UTC)
commit037acb8741eabb71693104f7807ffd848ac4d1f9 (patch) (unidiff)
tree8031f887a8bbd7dffa4d5dfdc29baa710b454638
parent40e681bf20db4f1e02212ae6e42a349ee000cf14 (diff)
downloadopie-037acb8741eabb71693104f7807ffd848ac4d1f9.zip
opie-037acb8741eabb71693104f7807ffd848ac4d1f9.tar.gz
opie-037acb8741eabb71693104f7807ffd848ac4d1f9.tar.bz2
move redundant code into one function
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp66
-rw-r--r--noncore/apps/advancedfm/advancedfm.h3
2 files changed, 19 insertions, 50 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 02898de..fec320d 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -43,20 +43,11 @@ AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
43 43
44 unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() ); 44 unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() );
45 45
46 initConnections(); 46 initConnections();
47 47 populateView();
48 whichTab = 1;
49 populateView();
50 // rePopulate();
51 // currentPathCombo->setFocus();
52 channel = new QCopChannel( "QPE/Application/advancedfm", this ); 48 channel = new QCopChannel( "QPE/Application/advancedfm", this );
53 connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&))); 49 connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&)));
54
55 // if( CurrentView() == Local_View)
56 // qDebug("LOCAL VIEW");
57 // else
58 // qDebug("REMOTE VIEW");
59 switchToLocalTab(); 50 switchToLocalTab();
60} 51}
61 52
62AdvancedFm::~AdvancedFm() { 53AdvancedFm::~AdvancedFm() {
@@ -289,28 +280,17 @@ void AdvancedFm::refreshCurrentTab() {
289 280
290} 281}
291 282
292void AdvancedFm::switchToLocalTab() { 283void AdvancedFm::switchToLocalTab() {
293 qDebug("switchToLocal "); 284 TabWidget->setCurrentWidget(0);
294 TabWidget->setCurrentWidget(0); 285 Local_View->setFocus();
295 Local_View->setFocus(); 286 whichTab = 1;
296 whichTab = 1;
297
298} 287}
299 288
300void AdvancedFm::switchToRemoteTab() { 289void AdvancedFm::switchToRemoteTab() {
301 qDebug("switchToRemoteTab() "); 290 TabWidget->setCurrentWidget(1);
302 TabWidget->setCurrentWidget(1); 291 Remote_View->setFocus();
303 Remote_View->setFocus(); 292 whichTab = 2;
304 whichTab = 2;
305}
306
307void AdvancedFm::readConfig() {
308 Config cfg("AdvancedFm");
309}
310
311void AdvancedFm::writeConfig() {
312 Config cfg("AdvancedFm");
313} 293}
314 294
315void AdvancedFm::currentPathComboChanged() { 295void AdvancedFm::currentPathComboChanged() {
316 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 296 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
@@ -361,42 +341,32 @@ QStringList AdvancedFm::getPath() {
361 } 341 }
362 return strList; 342 return strList;
363} 343}
364 344
365void AdvancedFm::homeButtonPushed() { 345void AdvancedFm::changeTo(QString dir) {
366 QString current = QDir::homeDirPath(); 346 chdir( dir.latin1());
367 chdir( current.latin1() ); 347 CurrentDir()->cd(dir, TRUE);
368 CurrentDir()->cd( current, TRUE);
369 populateView(); 348 populateView();
370 update(); 349 update();
371} 350}
372 351
352void AdvancedFm::homeButtonPushed() {
353 changeTo(QDir::homeDirPath());
354}
355
373void AdvancedFm::docButtonPushed() { 356void AdvancedFm::docButtonPushed() {
374 QString current = QPEApplication::documentDir(); 357 changeTo(QPEApplication::documentDir());
375 chdir( current.latin1() );
376 CurrentDir()->cd( current, TRUE);
377 populateView();
378 update();
379} 358}
380 359
381void AdvancedFm::SDButtonPushed() { 360void AdvancedFm::SDButtonPushed() {
382 QString current = "/mnt/card";// this can change so fix 361 changeTo("/mnt/card");// this can change so fix
383 chdir( current.latin1() );
384 CurrentDir()->cd( current, TRUE);
385 populateView();
386 update();
387} 362}
388 363
389void AdvancedFm::CFButtonPushed() { 364void AdvancedFm::CFButtonPushed() {
390 QString current;
391 if(zaurusDevice) 365 if(zaurusDevice)
392 current= "/mnt/cf"; //zaurus 366 changeTo("/mnt/cf"); //zaurus
393 else 367 else
394 current = "/mnt/hda"; //ipaq 368 changeTo("/mnt/hda"); //ipaq
395 chdir( current.latin1() );
396 CurrentDir()->cd( current, TRUE);
397 populateView();
398 update();
399} 369}
400 370
401 371
402void AdvancedFm::doAbout() { 372void AdvancedFm::doAbout() {
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 2234b3c..c52b853 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -96,8 +96,9 @@ protected:
96 QDir *OtherDir(); 96 QDir *OtherDir();
97 QListView *CurrentView(); 97 QListView *CurrentView();
98 QListView *OtherView(); 98 QListView *OtherView();
99 void setOtherTabCurrent(); 99 void setOtherTabCurrent();
100 void changeTo(QString & dir);
100 101
101//protected signals: 102//protected signals:
102 // void newPath(QString); 103 // void newPath(QString);
103 104
@@ -112,10 +113,8 @@ protected slots:
112 void populateView(); 113 void populateView();
113 void rePopulate(); 114 void rePopulate();
114 void showHidden(); 115 void showHidden();
115 void showMenuHidden(); 116 void showMenuHidden();
116 void writeConfig();
117 void readConfig();
118 void ListClicked(QListViewItem *); 117 void ListClicked(QListViewItem *);
119 void ListPressed( int, QListViewItem *, const QPoint&, int); 118 void ListPressed( int, QListViewItem *, const QPoint&, int);
120 void makeDir(); 119 void makeDir();
121 void doDelete(); 120 void doDelete();