author | bipolar <bipolar> | 2002-03-01 14:49:41 (UTC) |
---|---|---|
committer | bipolar <bipolar> | 2002-03-01 14:49:41 (UTC) |
commit | 2dfc5c76379baf8ae8ad6aed5f6c44d59d79087b (patch) (side-by-side diff) | |
tree | d4b0572e3204ab4b7bdacde937bca46392182f75 | |
parent | 38e7dc570dfbcea350795d9cf8f66b643ad159a8 (diff) | |
download | opie-2dfc5c76379baf8ae8ad6aed5f6c44d59d79087b.zip opie-2dfc5c76379baf8ae8ad6aed5f6c44d59d79087b.tar.gz opie-2dfc5c76379baf8ae8ad6aed5f6c44d59d79087b.tar.bz2 |
ljp (llornkcor) commited this. Fixes fileSaveas and filedialog positioning
when input method is opened. Added home buttons on each.
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 22 | ||||
-rw-r--r-- | core/apps/textedit/fileBrowser.h | 2 | ||||
-rw-r--r-- | core/apps/textedit/fileSaver.cpp | 29 | ||||
-rw-r--r-- | core/apps/textedit/fileSaver.h | 2 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 3 |
5 files changed, 45 insertions, 13 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 2275388..3e3cc3a 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp @@ -12,8 +12,9 @@ ** ****************************************************************************/ #include "fileBrowser.h" #include <qpe/config.h> +#include <qpe/resource.h> #include <qlistview.h> #include <qpushbutton.h> #include <qfile.h> @@ -24,14 +25,21 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "fileBrowser" ); - resize( 236, 280 ); + resize( 240, 280 ); setCaption(tr( "Browse for file" ) ); filterStr=filter; + dirLabel = new QLabel(this, "DirLabel"); dirLabel->setText(currentDir.canonicalPath()); - dirLabel->setGeometry(10,4,230,30); + dirLabel->setGeometry(10,20,230,15); + + QPushButton *homeButton; + homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); + homeButton->setGeometry(200,4,25,25); + connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); + ListView = new QListView( this, "ListView" ); ListView->addColumn( tr( "Name" ) ); ListView->setColumnWidth(0,140); ListView->setSorting( 2, FALSE); @@ -50,8 +58,9 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); currentDir.setPath(QDir::currentDirPath()); populateList(); + move(0,15); } fileBrowser::~fileBrowser() { @@ -93,9 +102,9 @@ void fileBrowser::populateList() item= new QListViewItem( ListView,fileL,fileS ); ++it; } ListView->setSorting( 2, FALSE); - dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); + dirLabel->setText(currentDir.canonicalPath()); } void fileBrowser::upDir() { @@ -161,4 +170,11 @@ void fileBrowser::OnOK() } } accept(); } + +void fileBrowser::homeButtonPushed() { + chdir( QDir::homeDirPath().latin1() ); + currentDir.cd( QDir::homeDirPath(), TRUE); + populateList(); + update(); +} diff --git a/core/apps/textedit/fileBrowser.h b/core/apps/textedit/fileBrowser.h index 17ed862..c0e1d4a 100644 --- a/core/apps/textedit/fileBrowser.h +++ b/core/apps/textedit/fileBrowser.h @@ -49,9 +49,9 @@ public: QStringList fileList; QListViewItem * item; public slots: - +void homeButtonPushed(); private: private slots: void upDir(); diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp index 9e9e863..de594aa 100644 --- a/core/apps/textedit/fileSaver.cpp +++ b/core/apps/textedit/fileSaver.cpp @@ -12,8 +12,10 @@ ** ****************************************************************************/ #include "fileSaver.h" #include <qpe/config.h> +#include <qpe/resource.h> + #include <qpe/qpeapplication.h> #include <qlistview.h> #include <qpushbutton.h> #include <qfile.h> @@ -27,18 +29,22 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "fileSaver" ); - resize( 236, 280 ); + resize( 240, 280 ); setCaption(tr( "Save file" ) ); QFileInfo fi(currentFileName); QString tmpFileName=fi.fileName(); // qDebug( tmpFileName); - dirLabel = new QLabel(this, "DirLabel"); dirLabel->setText(currentDir.canonicalPath()); - dirLabel->setGeometry(10,4,230,30); + dirLabel->setGeometry(10,20,230,15); + QPushButton *homeButton; + homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); + homeButton->setGeometry(200,4,25,25); + connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); + ListView = new QListView( this, "ListView" ); ListView->addColumn( tr( "Name" ) ); ListView->setColumnWidth(0,140); ListView->setSorting( 2, FALSE); @@ -49,26 +55,28 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl // ListView->setMultiSelection(true); // ListView->setSelectionMode(QListView::Extended); ListView->setAllColumnsShowFocus( TRUE ); - ListView->setGeometry( QRect( 10, 35, 220, 160 ) ); + ListView->setGeometry( QRect( 10,35,220,125)); fileEdit= new QLineEdit(this); - fileEdit->setGeometry( QRect( 10, 200, 200, 22)); + fileEdit->setGeometry( QRect( 10, 162, 205, 17)); fileEdit->setText( tmpFileName); filePermCheck = new QCheckBox( this, "SetFilePerms" ); filePermCheck->setText("set file permissions"); - filePermCheck->setGeometry(10, 220, 150,22); + filePermCheck->setGeometry(10, 178, 150,17); // signals and slots connections connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); // tmpFileName=fi.FilePath(); // qDebug( tmpFileName); currentDir.setPath( QDir::currentDirPath() ); populateList(); + move(0,15); + } fileSaver::~fileSaver() { @@ -108,9 +116,9 @@ void fileSaver::populateList() item= new QListViewItem( ListView,fileL,fileS ); ++it; } ListView->setSorting( 2, FALSE); - dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); + dirLabel->setText(currentDir.canonicalPath()); } @@ -185,4 +193,11 @@ void fileSaver::accept() { } qDebug("going to save "+selectedFileName); done(1); } + +void fileSaver::homeButtonPushed() { + chdir( QDir::homeDirPath().latin1() ); + currentDir.cd( QDir::homeDirPath(), TRUE); + populateList(); + update(); +} diff --git a/core/apps/textedit/fileSaver.h b/core/apps/textedit/fileSaver.h index ce4493e..526085d 100644 --- a/core/apps/textedit/fileSaver.h +++ b/core/apps/textedit/fileSaver.h @@ -54,9 +54,9 @@ public: QCheckBox *filePermCheck; QListViewItem * item; public slots: - +void homeButtonPushed(); private: private slots: void accept(); diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index bc975f3..72cc4d1 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -762,9 +762,9 @@ bool TextEdit::saveAs() } } - fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName); + fileSaveDlg=new fileSaver(this,"SaveFile",TRUE, 0, currentFileName); qDebug("wanna save filename "+currentFileName); fileSaveDlg->exec(); if( fileSaveDlg->result() == 1 ) { QString fileNm=fileSaveDlg->selectedFileName; @@ -888,8 +888,9 @@ void TextEdit::editDelete() case 0: if(doc) { doc->removeFiles(); clear(); + setCaption( tr("Text Editor") ); } break; case 1: // exit |