summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfm.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp79
1 files changed, 36 insertions, 43 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 4de7d38..02898de 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -47,14 +47,13 @@ AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
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&)) );
+ 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();
@@ -73,40 +72,38 @@ void AdvancedFm::cleanUp() {
QFile file( sfile);
if(file.exists())
file.remove();
}
void AdvancedFm::tabChanged(QWidget *wd) {
- if(wd == tab)
- odebug << "LOCAL VIEW SHOWN"<< oendl;
- else if(wd == tab_2)
- odebug<< "REMOTE VIEW SHOWN"<< oendl;
-
+// qDebug("tabChanged");
+ if(wd == tab) {
+ whichTab = 1;
+// qDebug("tabchanged: LOCAL VIEW SHOWN");
+ }
+ else if(wd == tab_2) {
+ whichTab = 2;
+// qDebug("tabchanged: REMOTE VIEW SHOWN");
+ }
+ qApp->processEvents();
QString path = CurrentDir()->canonicalPath();
- currentPathCombo->lineEdit()->setText( path );
-
+// qDebug(path);
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();
- }
-
+ currentPathCombo->lineEdit()->setText(path);
}
void AdvancedFm::populateView() {
QPixmap pm;
@@ -215,12 +212,13 @@ void AdvancedFm::populateView() {
thisView->setSorting( 3,FALSE);
fillCombo( (const QString &) path );
}
void AdvancedFm::rePopulate() {
+// qDebug("repopulate views");
populateView();
setOtherTabCurrent();
populateView();
// int tmpTab = whichTab;
// // odebug << "" << tmpTab << "" << oendl;
@@ -230,16 +228,16 @@ void AdvancedFm::rePopulate() {
// populateView();
// }
// TabWidget->setCurrentWidget( tmpTab - 1);
}
void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
- if ( TabWidget->currentWidget() == tab)
- qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local");
- else
- qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote");
+// 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);
@@ -289,20 +287,24 @@ void AdvancedFm::refreshCurrentTab() {
populateView();
// if ( TabWidget->currentWidget() == tab) {
}
void AdvancedFm::switchToLocalTab() {
+ qDebug("switchToLocal ");
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");
}
@@ -395,16 +397,13 @@ void AdvancedFm::CFButtonPushed() {
populateView();
update();
}
void AdvancedFm::doAbout() {
- QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n"
- "is copyright 2002-2003 by\n"
- "L.J.Potter<llornkcor@handhelds.org>\n"
- "and is licensed by the GPL"));
+ 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>"));
}
void AdvancedFm::keyPressEvent( QKeyEvent *e) {
// owarn << "key " << e->key() << "" << oendl;
// if( CurrentView()->hasFocus() )
{
@@ -579,14 +578,13 @@ void AdvancedFm::showFileMenu() {
if ( QFileInfo(fi).isDir() ) {
m->insertSeparator();
m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() ));
} else {
if ( app )
- m->insertItem( app->pixmap(), tr( "Open in "
- + app->name() ), this, SLOT( runThis() ) );
+ m->insertItem(app->pixmap(),tr("Open in " + app->name()),this,SLOT(runThis()));
else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this
m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) );
m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) );
}
m->insertItem(tr("Actions"),n);
@@ -594,16 +592,16 @@ void AdvancedFm::showFileMenu() {
n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
n->insertSeparator();
n->insertItem( tr( "Rename" ), this, SLOT( renameIt() ));
- n->insertItem( tr( "Copy" ), this, SLOT( copy() ));
- n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
- n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
- n->insertItem( tr( "Move" ), this, SLOT( move() ));
+ n->insertItem(tr("Copy"),this,SLOT(copyTimer()));
+ n->insertItem(tr("Copy As"),this,SLOT(copyAsTimer()));
+ n->insertItem(tr("Copy Same Dir"),this,SLOT(copySameDirTimer()));
+ n->insertItem(tr("Move"),this,SLOT(moveTimer()));
n->insertSeparator();
n->insertItem( tr( "Delete" ), this, SLOT( doDelete() ));
m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
@@ -785,21 +783,17 @@ void AdvancedFm::gotoCustomDir(const QString &dir) {
// populateView();
// }
}
}
QDir *AdvancedFm::CurrentDir() {
-
- if ( TabWidget->currentWidget() == tab)
- qDebug("CurrentTab is Local");
- else
- qDebug("CurrentTab is Remote");
-
if ( whichTab == 1) {
+// qDebug("CurrentTab is Local");
return &currentDir;
} else {
+// qDebug("CurrentTab is Remote");
return &currentRemoteDir;
}
}
QDir *AdvancedFm::OtherDir() {
// if ( TabWidget->currentWidget() == tab) {
@@ -808,33 +802,32 @@ QDir *AdvancedFm::OtherDir() {
} else {
return &currentDir;
}
}
QListView * AdvancedFm::CurrentView() {
- if ( TabWidget->currentWidget() == tab)
- odebug << "CurrentView local" << oendl;
-
// if ( TabWidget->currentWidget() == tab) {
if ( whichTab == 1) {
+// qDebug("CurrentView: local");
return Local_View;
} else {
// owarn << "CurrentView Tab 2" << oendl;
+// qDebug("CurrentView: remote");
return Remote_View;
}
}
QListView * AdvancedFm::OtherView() {
if ( whichTab == 1)
return Remote_View;
else
return Local_View;
}
void AdvancedFm::setOtherTabCurrent() {
- qDebug("setOtherTabCurrent() %d",whichTab);
+// qDebug("setOtherTabCurrent() %d",whichTab);
if ( whichTab == 1) {
TabWidget->setCurrentWidget(1);
} else {
TabWidget->setCurrentWidget(0);
}
OtherView()->setFocus();
@@ -855,13 +848,13 @@ void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
void AdvancedFm::setDocument(const QString &file) {
gotoDirectory( file);
}
void AdvancedFm::gotoDirectory(const QString &file) {
- qDebug("goto dir "+file);
+// qDebug("goto dir "+file);
QString curDir = file;
QDir *thisDir = CurrentDir();
if(QDir( curDir).exists() ) {
thisDir->setPath( curDir );
chdir( curDir.latin1() );
thisDir->cd( curDir, TRUE);
@@ -890,14 +883,14 @@ void AdvancedFm::findFile(const QString &fileName) {
it.current()->setSelected(true);
thisView->ensureItemVisible(it.current());
}
}
}
-void AdvancedFm::slotSwitchMenu(int ) {
-// odebug << "Switch " << item << "" << oendl;
+void AdvancedFm::slotSwitchMenu(int item) {
+// qDebug( "Switch %d",item);
// viewMenu->setItemChecked(item, true);
}
void AdvancedFm::navigateToSelected() {
if( !CurrentView()->currentItem()) return;
doDirChange();