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) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp30
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp20
2 files changed, 27 insertions, 23 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
@@ -48,67 +48,63 @@ AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
initConnections();
rePopulate();
channel = new QCopChannel( "QPE/Application/advancedfm", this );
connect(channel,SIGNAL(received(const QCString&,const QByteArray&)),this,SLOT(qcopReceive(const QCString&,const QByteArray&)));
switchToLocalTab();
}
AdvancedFm::~AdvancedFm() {
}
void AdvancedFm::cleanUp() {
QString sfile=QDir::homeDirPath();
if(sfile.right(1) != "/")
sfile+="/._temp";
else
sfile+="._temp";
QFile file( sfile);
if(file.exists())
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);
}
void AdvancedFm::populateView() {
QPixmap pm;
QListView *thisView = CurrentView();
QDir *thisDir = CurrentDir();
QString path = thisDir->canonicalPath();
thisView->clear();
thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
thisDir->setMatchAllDirs(TRUE);
thisDir->setNameFilter(filterStr);
QString fileL, fileS, fileDate;
QString fs = getFileSystemType((const QString &) path);
setCaption(tr("AdvancedFm :: ")+fs+" :: "
+checkDiskSpace((const QString &) path)+ tr(" kB free") );
bool isDir = FALSE;
@@ -245,57 +241,57 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) {
Q_UNUSED(item);
switch (mouse) {
case 1:
{
if(renameBox != 0 ) {
cancelRename();
}
}
break;
// case 2:
// menuTimer.start( 50, TRUE );
// break;
};
}
void AdvancedFm::refreshCurrentTab() {
populateView();
// 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();
if(QDir(pDir).exists()) {
CurrentDir()->setPath(pDir );
populateView();
} else {
QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir));
}
}
void AdvancedFm::fillCombo(const QString &currentPath) {
if ( TabWidget->currentWidget() == tab) {
// if ( whichTab == 1) {
currentPathCombo->lineEdit()->setText( currentPath);
if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
currentPathCombo->clear();
localDirPathStringList.prepend( currentPath );
currentPathCombo->insertStringList( localDirPathStringList,-1);
}
} else {
currentPathCombo->lineEdit()->setText( currentPath);
@@ -737,33 +733,39 @@ void AdvancedFm::setOtherTabCurrent() {
} else {
TabWidget->setCurrentWidget(0);
}
// OtherView()->setFocus();
OtherView()->setSelected( CurrentView()->firstChild(), true);
}
void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
// odebug << "qcop message "+msg << oendl;
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "openDirectory(QString)" ) {
// odebug << "received" << oendl;
QString file;
stream >> file;
changeTo( (const QString &) file);
}
}
void AdvancedFm::setDocument(const QString &file) {
changeTo( 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;
doDirChange();
}
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
@@ -736,61 +736,63 @@ void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
QString lineStr = buffer;
QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
}
bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
if ( o->inherits( "QLineEdit" ) ) {
if ( e->type() == QEvent::KeyPress ) {
QKeyEvent *ke = (QKeyEvent*)e;
if ( ke->key() == Key_Return ||
ke->key() == Key_Enter ) {
okRename();
return true;
}
else if ( ke->key() == Key_Escape ) {
cancelRename();
return true;
}
}
else if ( e->type() == QEvent::FocusOut ) {
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;
QListView * view;
view = CurrentView();
bool resetFocus = view->viewport()->focusProxy() == renameBox;
delete renameBox;
renameBox = 0;
if ( resetFocus ) {
view->viewport()->setFocusProxy( view);
view->setFocus();
}
}
void AdvancedFm::doRename(QListView * view) {
if( !CurrentView()->currentItem()) return;
QRect r = view->itemRect( view->currentItem( ));
r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
r.setX( view->contentsX() );