summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-09-28 08:38:46 (UTC)
committer llornkcor <llornkcor>2004-09-28 08:38:46 (UTC)
commita1482c1dfd0f0859736716a7ce4a459a8e02728c (patch) (side-by-side diff)
tree53b148c95d28fb0286dfccb50462b6f673067057
parentc6daaf1849427191cb449e742681629bdaee4570 (diff)
downloadopie-a1482c1dfd0f0859736716a7ce4a459a8e02728c.zip
opie-a1482c1dfd0f0859736716a7ce4a459a8e02728c.tar.gz
opie-a1482c1dfd0f0859736716a7ce4a459a8e02728c.tar.bz2
ugly workaround for bigscreen/smallscreen widget differences
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp30
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp62
2 files changed, 48 insertions, 44 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 9aa0c77..8cc5d7b 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -68,27 +68,23 @@ void AdvancedFm::cleanUp() {
file.remove();
}
void AdvancedFm::tabChanged(QWidget *wd) {
-// qDebug("tabChanged");
if(wd == tab) {
whichTab = 1;
viewMenu->setItemChecked(viewMenu->idAt(0), true);
viewMenu->setItemChecked(viewMenu->idAt(1), false);
// qDebug("tabchanged: LOCAL VIEW SHOWN");
}
+
else if(wd == tab_2) {
whichTab = 2;
viewMenu->setItemChecked(viewMenu->idAt(0), false);
viewMenu->setItemChecked(viewMenu->idAt(1), true);
// qDebug("tabchanged: REMOTE VIEW SHOWN");
}
qApp->processEvents();
QString path = CurrentDir()->canonicalPath();
-// qDebug(path);
- if ( TabWidget->currentWidget() == tab) {
- } else {
- }
chdir( path.latin1());
currentPathCombo->lineEdit()->setText(path);
}
@@ -265,17 +261,17 @@ void AdvancedFm::refreshCurrentTab() {
// if ( TabWidget->currentWidget() == tab) {
}
void AdvancedFm::switchToLocalTab() {
- TabWidget->setCurrentWidget(0);
-// Local_View->setFocus();
- whichTab = 1;
+ TabWidget->setCurrentWidget(tab);
+ Local_View->setFocus();
+// whichTab = 1;
}
void AdvancedFm::switchToRemoteTab() {
- TabWidget->setCurrentWidget(1);
-// Remote_View->setFocus();
- whichTab = 2;
+ TabWidget->setCurrentWidget(tab_2);
+ Remote_View->setFocus();
+// whichTab = 2;
}
void AdvancedFm::currentPathComboChanged() {
QString pDir = currentPathCombo->lineEdit()->text();
@@ -757,11 +753,17 @@ void AdvancedFm::setDocument(const QString &file) {
}
void AdvancedFm::slotSwitchMenu(int item) {
- Q_UNUSED(item);
-// qDebug( "Switch %d",item);
- // viewMenu->setItemChecked(item, true);
+ if(item == -23) {
+ switchToLocalTab();
+ tabChanged( tab);
+ }
+
+ if(item == -24) {
+ switchToRemoteTab();
+ tabChanged( tab_2);
+ }
}
void AdvancedFm::navigateToSelected() {
if( !CurrentView()->currentItem()) return;
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 171e7c4..4802771 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -43,9 +43,9 @@ void AdvancedFm::doDirChange() {
ListClicked( CurrentView()->currentItem());
} else {
if( pathItem.find(" -> ",0,TRUE) != -1)
pathItem = dealWithSymName((const QString&)pathItem)+"/";
-// owarn << pathItem << oendl;
+// owarn << pathItem << oendl;
changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
}
}
@@ -94,9 +94,9 @@ void AdvancedFm::runThis() {
if(curFile != "../") {
fs = getFileSystemType((const QString &) path);
QFileInfo fileInfo( path + "/" + curFile);
-// odebug << fileInfo.owner() << oendl;
+// odebug << fileInfo.owner() << oendl;
if( (fileInfo.permission( QFileInfo::ExeUser)
| fileInfo.permission( QFileInfo::ExeGroup)
| fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
@@ -106,9 +106,9 @@ void AdvancedFm::runThis() {
} else {
curFile = path + "/" + curFile;
DocLnk nf(curFile);
QString execStr = nf.exec();
-// odebug << execStr << oendl;
+// odebug << execStr << oendl;
if( execStr.isEmpty() ) {
} else {
nf.execute();
}
@@ -204,14 +204,14 @@ void AdvancedFm::doDelete() {
QString cmd="rm "+f;
QFile file(f);
QFileInfo fi(myFile);
if( fi.fileName().find("../",0,TRUE)==-1) {
-// odebug << "remove link files "+myFile << oendl;
+// odebug << "remove link files "+myFile << oendl;
// DocLnk lnk(f);
DocLnk *lnk;
lnk = new DocLnk(f);
-// odebug << "Deleting doclnk " + lnk->linkFile() << oendl;
+// odebug << "Deleting doclnk " + lnk->linkFile() << oendl;
if(lnk->isValid())
lnk->removeLinkFile();
// delete lnk;
file.remove();
@@ -245,12 +245,12 @@ void AdvancedFm::doProperties() {
QString filePath;
filePath = CurrentDir()->canonicalPath()+"/";
-// odebug << "" << curFileList.count() << "" << oendl;
+// odebug << "" << curFileList.count() << "" << oendl;
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
-// odebug << (filePath+*it) << oendl;
+// odebug << (filePath+*it) << oendl;
DocLnk lnk( (filePath+*it));
LnkProperties prop( &lnk );
QPEApplication::execDialog( &prop );
}
@@ -301,10 +301,10 @@ void AdvancedFm::copy() {
curFile = thisDir->canonicalPath()+"/"+ item;
destFile = thatDir->canonicalPath()+"/"+ item;
-// odebug << "Destination file is "+destFile << oendl;
-// odebug << "CurrentFile file is " + curFile << oendl;
+// odebug << "Destination file is "+destFile << oendl;
+// odebug << "CurrentFile file is " + curFile << oendl;
QFile f(destFile);
if( f.exists()) {
if(doMsg) {
@@ -425,9 +425,9 @@ void AdvancedFm::copySameDir() {
QMessageBox::message("AdvancedFm",tr("<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile));
return;
}
-// odebug << "copy "+curFile+" as "+destFile << oendl;
+// odebug << "copy "+curFile+" as "+destFile << oendl;
}
delete fileDlg;
}
rePopulate();
@@ -451,15 +451,15 @@ void AdvancedFm::move() {
if(destFile.right(1).find("/",0,TRUE) == -1)
destFile+="/";
destFile += item;
-// odebug << "Destination file is "+destFile << oendl;
+// odebug << "Destination file is "+destFile << oendl;
curFile = thisDir->canonicalPath();
if(curFile.right(1).find("/",0,TRUE) == -1)
curFile +="/";
curFile+= item;
-// odebug << "CurrentFile file is " + curFile << oendl;
+// odebug << "CurrentFile file is " + curFile << oendl;
if(QFileInfo(curFile).isDir()) {
moveDirectory( curFile, destFile );
rePopulate();
@@ -503,9 +503,9 @@ bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) {
bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) {
QString cmd = "/bin/cp -fpR " + src + " " + dest;
- owarn << cmd << oendl;
+ owarn << cmd << oendl;
int err = system( (const char *) cmd );
if ( err != 0 ) {
QMessageBox::message("AdvancedFm", tr( "<p>Could not copy %1 to %2</p>").arg( src ).arg( dest ) );
return false;
@@ -536,16 +536,16 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
int write_fd=0;
struct stat stat_buf;
off_t offset = 0;
if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
-// owarn << "open failed" << oendl;
+// owarn << "open failed" << oendl;
return success = false;
}
read_fd = srcFile.handle();
if(read_fd != -1) {
fstat (read_fd, &stat_buf);
if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
-// owarn << "destfile open failed" << oendl;
+// owarn << "destfile open failed" << oendl;
return success = false;
}
write_fd = destFile.handle();
if(write_fd != -1) {
@@ -558,9 +558,9 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
case ENOMEM: msg = "Insufficient memory to read from in_fd.";
case EIO: msg = "Unspecified error while reading from in_fd.";
};
success = false;
-// owarn << msg << oendl;
+// owarn << msg << oendl;
}
} else {
success = false;
}
@@ -590,9 +590,9 @@ void AdvancedFm::runCommand() {
fileDlg->exec();
//QString command;
if( fileDlg->result() == 1 ) {
-// odebug << fileDlg->LineEdit1->text() << oendl;
+// odebug << fileDlg->LineEdit1->text() << oendl;
QStringList command;
command << "/bin/sh";
command << "-c";
@@ -673,9 +673,9 @@ void AdvancedFm::mkSym() {
curFile = curFile.left( curFile.length() -1);
}
cmd = "ln -s "+curFile+" "+destName;
-// odebug << cmd << oendl;
+// odebug << cmd << oendl;
startProcess( (const QString)cmd );
}
rePopulate();
setOtherTabCurrent();
@@ -723,17 +723,17 @@ void AdvancedFm::startProcess(const QString & cmd) {
command << "-c";
command << cmd.latin1();
*process << command;
if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
- odebug << "could not start process" << oendl;
+ odebug << "could not start process" << oendl;
}
void AdvancedFm::processEnded(OProcess *) {
rePopulate();
}
void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
-// owarn << "received stderrt " << buflen << " bytes" << oendl;
+// owarn << "received stderrt " << buflen << " bytes" << oendl;
QString lineStr = buffer;
QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
}
@@ -756,27 +756,29 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
cancelRename();
return true;
}
}
-/* if ( o->inherits( "QListView" ) ) {
+ if ( o->inherits( "QListView" ) ) {
if ( e->type() == QEvent::FocusIn ) {
-// if( o == Local_View) { //keep track of which view
-// qDebug("local view");
-// whichTab = 1;
-// } else {
-// whichTab = 2;
-// qDebug("remote view");
-// }
+ if( o == Local_View) { //keep track of which view
+ whichTab = 1;
+ viewMenu->setItemChecked(viewMenu->idAt(0), true);
+ viewMenu->setItemChecked(viewMenu->idAt(1), false);
+ } else {
+ whichTab = 2;
+ viewMenu->setItemChecked(viewMenu->idAt(0), false);
+ viewMenu->setItemChecked(viewMenu->idAt(1), true);
+ }
}
OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
}
-*/
+
return QWidget::eventFilter( o, e );
}
void AdvancedFm::cancelRename() {
-// odebug << "cancel rename" << oendl;
+// odebug << "cancel rename" << oendl;
QListView * view;
view = CurrentView();
bool resetFocus = view->viewport()->focusProxy() == renameBox;