summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-09-25 04:28:01 (UTC)
committer llornkcor <llornkcor>2004-09-25 04:28:01 (UTC)
commit037acb8741eabb71693104f7807ffd848ac4d1f9 (patch) (side-by-side diff)
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
@@ -41,24 +41,15 @@ AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
init();
renameBox = 0;
unknownXpm = Resource::loadImage("UnknownDocument").smoothScale(AppLnk::smallIconSize(),AppLnk::smallIconSize() );
initConnections();
-
- whichTab = 1;
- populateView();
-// rePopulate();
-// currentPathCombo->setFocus();
+ populateView();
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() {
}
@@ -287,32 +278,21 @@ void AdvancedFm::refreshCurrentTab() {
populateView();
// if ( TabWidget->currentWidget() == tab) {
}
void AdvancedFm::switchToLocalTab() {
- qDebug("switchToLocal ");
- TabWidget->setCurrentWidget(0);
- Local_View->setFocus();
- whichTab = 1;
-
+ TabWidget->setCurrentWidget(0);
+ Local_View->setFocus();
+ whichTab = 1;
}
void AdvancedFm::switchToRemoteTab() {
- qDebug("switchToRemoteTab() ");
- TabWidget->setCurrentWidget(1);
- Remote_View->setFocus();
- whichTab = 2;
-}
-
-void AdvancedFm::readConfig() {
- Config cfg("AdvancedFm");
-}
-
-void AdvancedFm::writeConfig() {
- Config cfg("AdvancedFm");
+ TabWidget->setCurrentWidget(1);
+ Remote_View->setFocus();
+ whichTab = 2;
}
void AdvancedFm::currentPathComboChanged() {
if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
CurrentDir()->setPath( currentPathCombo->lineEdit()->text() );
populateView();
@@ -359,46 +339,36 @@ QStringList AdvancedFm::getPath() {
// odebug << it.current()->text(0) << oendl;
}
}
return strList;
}
-void AdvancedFm::homeButtonPushed() {
- QString current = QDir::homeDirPath();
- chdir( current.latin1() );
- CurrentDir()->cd( current, TRUE);
+void AdvancedFm::changeTo(QString dir) {
+ chdir( dir.latin1());
+ CurrentDir()->cd(dir, TRUE);
populateView();
update();
}
+void AdvancedFm::homeButtonPushed() {
+ changeTo(QDir::homeDirPath());
+}
+
void AdvancedFm::docButtonPushed() {
- QString current = QPEApplication::documentDir();
- chdir( current.latin1() );
- CurrentDir()->cd( current, TRUE);
- populateView();
- update();
+ changeTo(QPEApplication::documentDir());
}
void AdvancedFm::SDButtonPushed() {
- QString current = "/mnt/card";// this can change so fix
- chdir( current.latin1() );
- CurrentDir()->cd( current, TRUE);
- populateView();
- update();
+ changeTo("/mnt/card");// this can change so fix
}
void AdvancedFm::CFButtonPushed() {
- QString current;
if(zaurusDevice)
- current= "/mnt/cf"; //zaurus
+ changeTo("/mnt/cf"); //zaurus
else
- current = "/mnt/hda"; //ipaq
- chdir( current.latin1() );
- CurrentDir()->cd( current, TRUE);
- populateView();
- update();
+ changeTo("/mnt/hda"); //ipaq
}
void AdvancedFm::doAbout() {
QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>"));
}
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
@@ -94,12 +94,13 @@ protected:
QString dealWithSymName(const QString &);
QDir *CurrentDir();
QDir *OtherDir();
QListView *CurrentView();
QListView *OtherView();
void setOtherTabCurrent();
+ void changeTo(QString & dir);
//protected signals:
// void newPath(QString);
protected slots:
void slotSwitchMenu(int);
@@ -110,14 +111,12 @@ protected slots:
void del();
void rn();
void populateView();
void rePopulate();
void showHidden();
void showMenuHidden();
- void writeConfig();
- void readConfig();
void ListClicked(QListViewItem *);
void ListPressed( int, QListViewItem *, const QPoint&, int);
void makeDir();
void doDelete();
void tabChanged(QWidget*);
void cleanUp();