summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-04-22 17:39:18 (UTC)
committer harlekin <harlekin>2003-04-22 17:39:18 (UTC)
commitb22d89883cd92bd9d858caf5ca90b6eef80598d4 (patch) (side-by-side diff)
tree695ff1e42ca09098d8b0cba0b95f0f2f736e0fd2
parentab9387322c5802f75bc9b37b3bb334bd98dd5dd1 (diff)
downloadopie-b22d89883cd92bd9d858caf5ca90b6eef80598d4.zip
opie-b22d89883cd92bd9d858caf5ca90b6eef80598d4.tar.gz
opie-b22d89883cd92bd9d858caf5ca90b6eef80598d4.tar.bz2
- a lot of includes and gui cleanups
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp39
-rw-r--r--noncore/apps/advancedfm/advancedfm.h5
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp82
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp4
4 files changed, 47 insertions, 83 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 41e83c7..66353bb 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,105 +1,80 @@
/***************************************************************************
AdvancedFm.cpp
-------------------
** Created: Sat Mar 9 23:33:09 2002
copyright : (C) 2002 by ljp
email : ljp@llornkcor.com
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#define DEVELOPERS_VERSION
#include "advancedfm.h"
-#include <opie/otabwidget.h>
+
// #include <opie/ofileselector.h>
// #include <opie/ofiledialog.h>
-#include <qpe/config.h>
+#include <opie/otabwidget.h>
+
#include <qpe/filemanager.h>
#include <qpe/qcopenvelope_qws.h>
-#include <qpe/qpemenubar.h>
-#include <qpe/qpetoolbar.h>
#include <qpe/qpeapplication.h>
-#include <qpe/qcopenvelope_qws.h>
#include <qpe/config.h>
#include <qpe/mimetype.h>
#include <qpe/applnk.h>
#include <qpe/ir.h>
#include <qpe/resource.h>
#include <qpe/menubutton.h>
-
-#include <qwmatrix.h>
-#include <qregexp.h>
-#include <qtabwidget.h>
-#include <qtextstream.h>
-#include <qpushbutton.h>
#include <qdatetime.h>
-#include <qdir.h>
#include <qfile.h>
-#include <qstring.h>
#include <qcombobox.h>
#include <qpopupmenu.h>
#include <qlistview.h>
-#include <qmainwindow.h>
#include <qlabel.h>
-#include <qprogressbar.h>
-#include <qspinbox.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qimage.h>
-#include <qpixmap.h>
#include <qmessagebox.h>
#include <qlineedit.h>
-#include <qregexp.h>
-#include <unistd.h>
-#include <stdlib.h>
#include <sys/stat.h>
-#include <dirent.h>
-#include <stdio.h>
#include <time.h>
+#include <dirent.h>
#include <fcntl.h>
-#include <mntent.h>
-#include <string.h>
-#include <errno.h>
#include <sys/vfs.h>
#include <mntent.h>
-#include <sys/utsname.h>
AdvancedFm::AdvancedFm( )
: QMainWindow( ) {
init();
renameBox = 0;
- QWMatrix matrix;
- QPixmap pix(Resource::loadPixmap( "UnknownDocument" ));
- matrix.scale( .4, .4);
- unknownXpm = pix.xForm(matrix);
-
+ unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
+
initConnections();
whichTab=1;
rePopulate();
currentPathCombo->setFocus();
}
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 *w)
{
@@ -189,49 +164,49 @@ void AdvancedFm::populateView()
{
pm = Resource::loadPixmap( "exec");
}
else if( !fi->isReadable() )
{
pm = Resource::loadPixmap( "locked" );
}
else { //everything else goes by mimetype
MimeType mt(fi->filePath());
pm=mt.pixmap(); //sets the correct pixmap for mimetype
if(pm.isNull()) {
pm = unknownXpm;
}
}
if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1)
{
// overlay link image
pm= Resource::loadPixmap( "folder" );
QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
QPainter painter( &pm );
painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
pm.setMask( pm.createHeuristicMask( FALSE ) );
}
item->setPixmap( 0,pm);
-
+
}
isDir=FALSE;
++it;
}
if( path.find("dev",0,TRUE) != -1)
{
struct stat buf;
dev_t devT;
DIR *dir;
struct dirent *mydirent;
if((dir = opendir( path.latin1())) != NULL)
while ((mydirent = readdir(dir)) != NULL)
{
lstat( mydirent->d_name, &buf);
// qDebug(mydirent->d_name);
fileL.sprintf("%s", mydirent->d_name);
devT = buf.st_dev;
fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
fileDate.sprintf("%s", ctime( &buf.st_mtime));
if( fileL.find(".") == -1 )
{
item= new QListViewItem( thisView, fileL, fileS, fileDate);
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index c30d8e0..4480051 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -19,63 +19,60 @@
#include <qpe/ir.h>
#include <qvariant.h>
#include <qdialog.h>
#include <qmainwindow.h>
#include <qstringlist.h>
#include <qdir.h>
#include <qstring.h>
#include <qpoint.h>
#include <qtimer.h>
#include <qpixmap.h>
class OTabWidget;
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QComboBox;
class QListView;
class QListviewItem;
class QLabel;
class QProgressBar;
class QSpinBox;
class QTabWidget;
class QWidget;
-class QPEToolBar;
-class QPEMenuBar;
class QPopupMenu;
class QFile;
class QListViewItem;
class QLineEdit;
class MenuButton;
-//class QPushButton;
class QToolButton;
class Ir;
class AdvancedFm : public QMainWindow
{
- Q_OBJECT
+ Q_OBJECT
public:
AdvancedFm();
~AdvancedFm();
protected slots:
void selectAll();
void addToDocs();
void doDirChange();
void mkDir();
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();
void renameIt();
void runThis();
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index 1a7a6d7..eb2bcd8 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -1,162 +1,156 @@
/***************************************************************************
advancedfmData.cpp
-------------------
** Created: Mon 09-23-2002 13:24:11
copyright : (C) 2002 by ljp
email : ljp@llornkcor.com
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "advancedfm.h"
#include <opie/otabwidget.h>
#include <qpe/qpeapplication.h>
-#include <qpe/qpemenubar.h>
-#include <qpe/qpetoolbar.h>
#include <qpe/resource.h>
#include <qpe/menubutton.h>
-#include <qpe/config.h>
#include <qlayout.h>
-#include <qpixmap.h>
+#include <qhbox.h>
+#include <qmenubar.h>
#include <qcombobox.h>
-#include <qpopupmenu.h>
-#include <qtabwidget.h>
#include <qtoolbutton.h>
#include <qlineedit.h>
#include <qlistview.h>
#include <sys/utsname.h>
void AdvancedFm::init() {
#if defined(QT_QWS_OPIE)
qDebug("<<<<<<<<<<<<<<<<<<<<<<<< OPIE!!!");
#endif
setCaption( tr( "AdvancedFm" ) );
- QGridLayout *layout = new QGridLayout( this );
- layout->setSpacing( 2);
- layout->setMargin( 2);
+ QVBoxLayout *layout = new QVBoxLayout( this );
+ layout->setSpacing( 2);
+ layout->setMargin( 2);
- QPEMenuBar *menuBar = new QPEMenuBar(this);
+ QMenuBar *menuBar = new QMenuBar(this);
fileMenu = new QPopupMenu( this );
viewMenu = new QPopupMenu( this );
// customDirMenu = new QPopupMenu( this );
- layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 );
+ layout->addWidget( menuBar );
menuBar->insertItem( tr( "File" ), fileMenu);
menuBar->insertItem( tr( "View" ), viewMenu);
-// menuBar->insertItem( tr( "^" ), customDirMenu);
- cdUpButton = new QToolButton( this,"cdUpButton");
+ cdUpButton = new QToolButton( 0,"cdUpButton");
cdUpButton->setPixmap(Resource::loadPixmap("up"));
- cdUpButton->setFixedSize( QSize( 20, 20 ) );
- layout->addMultiCellWidget( cdUpButton , 0, 0, 2, 2);
+ cdUpButton->setAutoRaise( true );
+ menuBar->insertItem( cdUpButton );
- menuButton = new MenuButton(this);
- menuButton->setFixedSize( QSize( 20, 20 ) );
- layout->addMultiCellWidget( menuButton , 0, 0, 3, 3);
- qpeDirButton= new QToolButton(this,"QPEButton");
+ QHBox *lineBox = new QHBox( this );
+
+ qpeDirButton= new QToolButton( 0,"QPEButton");
qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
- qpeDirButton ->setFixedSize( QSize( 20, 20 ) );
- layout->addMultiCellWidget( qpeDirButton , 0, 0, 4, 4);
+ qpeDirButton->setAutoRaise( true );
+ menuBar->insertItem( qpeDirButton );
- cfButton = new QToolButton( this,"CFButton");
+ cfButton = new QToolButton( 0, "CFButton");
cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
- cfButton ->setFixedSize( QSize( 20, 20 ) );
- layout->addMultiCellWidget( cfButton , 0, 0, 5, 5);
+ cfButton->setAutoRaise( true );
+ menuBar->insertItem( cfButton );
- sdButton = new QToolButton( this,"SDButton");
+ sdButton = new QToolButton( 0, "SDButton");
sdButton->setPixmap(Resource::loadPixmap("advancedfm/sdcard"));
- sdButton->setFixedSize( QSize( 20, 20 ) );
- layout->addMultiCellWidget( sdButton , 0, 0, 6, 6);
-
+ sdButton->setAutoRaise( true );
+ menuBar->insertItem( sdButton );
- docButton = new QToolButton( this,"docsButton");
+ docButton = new QToolButton( 0,"docsButton");
docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
- docButton->setFixedSize( QSize( 20, 20 ) );
- layout->addMultiCellWidget( docButton, 0, 0, 7, 7);
+ docButton->setAutoRaise( true );
+ menuBar->insertItem( docButton );
- homeButton = new QToolButton( this,"homeButton");
+ homeButton = new QToolButton( 0, "homeButton");
homeButton->setPixmap(Resource::loadPixmap("home"));
- homeButton->setFixedSize( QSize( 20, 20 ) );
- layout->addMultiCellWidget( homeButton, 0, 0, 8, 8);
+ homeButton->setAutoRaise( true );
+ menuBar->insertItem( homeButton );
fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
fileMenu->insertSeparator();
fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
fileMenu->insertSeparator();
fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ));
fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
fileMenu->setCheckable(TRUE);
viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
// viewMenu->insertSeparator();
// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
viewMenu->setCheckable(TRUE);
s_addBookmark = tr("Bookmark Directory");
s_removeBookmark = tr("Remove Current Directory from Bookmarks");
- menuButton->setUseLabel(false);
- menuButton->insertItem( s_addBookmark);
- menuButton->insertItem( s_removeBookmark);
- menuButton->insertSeparator();
// menuButton->insertItem("");
// customDirMenu->insertItem(tr("Add This Directory"));
// customDirMenu->insertItem(tr("Remove This Directory"));
// customDirMenu->insertSeparator();
customDirsToMenu();
- currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
- currentPathCombo->setEditable(TRUE);
- layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 8);
- currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
+ menuButton = new MenuButton( lineBox );
+ menuButton->setUseLabel(false);
+ menuButton->setMaximumWidth( 20 );
+ menuButton->insertItem( s_addBookmark);
+ menuButton->insertItem( s_removeBookmark);
+ menuButton->insertSeparator();
+
+ currentPathCombo = new QComboBox( FALSE, lineBox, "currentPathCombo" );
+ currentPathCombo->setEditable(TRUE);
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
- layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 8);
+ layout->addWidget( lineBox );
TabWidget = new OTabWidget( this, "TabWidget",/* OTabWidget::Global | */OTabWidget::IconTab);
// TabWidget = new QTabWidget( this, "TabWidget" );
- layout->addMultiCellWidget( TabWidget, 2, 2, 0, 8);
+ layout->addWidget( TabWidget, 4 );
tab = new QWidget( TabWidget, "tab" );
tabLayout = new QGridLayout( tab );
tabLayout->setSpacing( 2);
tabLayout->setMargin( 2);
Local_View = new QListView( tab, "Local_View" );
Local_View->addColumn( tr("File"),130);
Local_View->addColumn( tr("Size"),-1);
Local_View->setColumnAlignment(1,QListView::AlignRight);
Local_View->addColumn( tr("Date"),-1);
Local_View->setColumnAlignment(2,QListView::AlignRight);
Local_View->setAllColumnsShowFocus(TRUE);
Local_View->setMultiSelection( TRUE );
Local_View->setSelectionMode(QListView::Extended);
QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
tabLayout->addWidget( Local_View, 0, 0 );
TabWidget->addTab( tab,"advancedfm/smFileBrowser.png", tr("1"));
// TabWidget->insertTab( tab, tr("1"));
tab_2 = new QWidget( TabWidget, "tab_2" );
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index eae86a4..575833a 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1,46 +1,44 @@
/***************************************************************************
AdvancedFm.cpp
-------------------
** Created: Sat Mar 9 23:33:09 2002
copyright : (C) 2002 by ljp
email : ljp@llornkcor.com
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "advancedfm.h"
#include "output.h"
#include "filePermissions.h"
#include <opie/otabwidget.h>
#include <opie/oprocess.h>
#include <qpe/lnkproperties.h>
#include <qpe/qpeapplication.h>
-#include <qpe/qpemenubar.h>
-#include <qpe/qpetoolbar.h>
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/applnk.h>
#include <qpe/ir.h>
#include <qmessagebox.h>
#include <qmultilineedit.h>
#include <qstring.h>
#include <qlayout.h>
#include <qpixmap.h>
#include <qcombobox.h>
#include <qpopupmenu.h>
#include <qtabwidget.h>
#include <qtoolbutton.h>
#include <qtabwidget.h>
#include <qlineedit.h>
#include <qlistview.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
@@ -753,49 +751,49 @@ void AdvancedFm::startProcess(const QString & cmd)
connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)),
this, SLOT( oprocessStderr(OProcess *, char *, int)));
command << "/bin/sh";
command << "-c";
command << cmd.latin1();
*process << command;
if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
qDebug("could not start process");
}
void AdvancedFm::processEnded(OProcess *)
{
// populateLocalView();
populateView();
}
void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int buflen) {
qWarning("received stderrt %d bytes", buflen);
QString lineStr = buffer;
// lineStr=lineStr.left(lineStr.length()-1);
QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
-
+
// OutputEdit->append(lineStr);
// OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
}
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 )