-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 44 | ||||
-rw-r--r-- | core/apps/textedit/fileBrowser.h | 11 | ||||
-rw-r--r-- | core/apps/textedit/fileSaver.cpp | 35 | ||||
-rw-r--r-- | core/apps/textedit/fileSaver.h | 7 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 4 |
5 files changed, 85 insertions, 16 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 8c1e962..c16bd41 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp @@ -15,4 +15,5 @@ #include <qpe/config.h> #include <qpe/resource.h> +#include <qpe/qpeapplication.h> #include <qlistview.h> @@ -22,4 +23,6 @@ #include <unistd.h> + + fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) : QDialog( parent, name, modal, fl ) @@ -35,9 +38,20 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags dirLabel->setGeometry(10,20,230,15); - QPushButton *homeButton; - homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); + homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); homeButton->setGeometry(200,4,25,25); connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); - + homeButton->setFlat(TRUE); + + docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); + docButton->setGeometry(170,4,25,25); + connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); + docButton->setFlat(TRUE); + + hideButton = new QPushButton( Resource::loadIconSet("s_hidden"),"",this,"hideButton"); + hideButton->setGeometry(140,4,25,25); + connect( hideButton,SIGNAL(toggled(bool)),this,SLOT( hideButtonPushed(bool)) ); + hideButton->setToggleButton(TRUE); + hideButton->setFlat(TRUE); + ListView = new QListView( this, "ListView" ); ListView->addColumn( tr( "Name" ) ); @@ -59,4 +73,6 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); currentDir.setPath(QDir::currentDirPath()); + currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); + populateList(); move(0,15); @@ -72,5 +88,4 @@ void fileBrowser::populateList() ListView->clear(); //qDebug(currentDir.canonicalPath()); - currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentDir.setMatchAllDirs(TRUE); @@ -179,2 +194,23 @@ void fileBrowser::homeButtonPushed() { update(); } + +void fileBrowser::docButtonPushed() { + chdir( QString(QPEApplication::documentDir()+"/text").latin1() ); + currentDir.cd( QPEApplication::documentDir()+"/text", TRUE); + populateList(); + update(); + +} + +void fileBrowser::hideButtonPushed(bool b) { + if (b) + currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + else + currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + +// chdir( QString(QPEApplication::documentDir()+"/text").latin1() ); +// currentDir.cd( QPEApplication::documentDir()+"/text", TRUE); + populateList(); + update(); + +} diff --git a/core/apps/textedit/fileBrowser.h b/core/apps/textedit/fileBrowser.h index c0e1d4a..50ed485 100644 --- a/core/apps/textedit/fileBrowser.h +++ b/core/apps/textedit/fileBrowser.h @@ -40,7 +40,7 @@ public: ~fileBrowser(); - QPushButton* buttonOk; + QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton; QListView* ListView; - QPushButton* buttonCancel; + QLabel *dirLabel; QString selectedFileName, filterStr; @@ -48,8 +48,9 @@ public: QFile file; QStringList fileList; - -QListViewItem * item; + QListViewItem * item; public slots: -void homeButtonPushed(); + void homeButtonPushed(); + void docButtonPushed(); + void hideButtonPushed(bool); private: diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp index 4e80735..fbf50cf 100644 --- a/core/apps/textedit/fileSaver.cpp +++ b/core/apps/textedit/fileSaver.cpp @@ -40,9 +40,20 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl 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()) ); + homeButton->setFlat(TRUE); + docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); + docButton->setGeometry(170,4,25,25); + connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); + docButton->setFlat(TRUE); + + hideButton = new QPushButton( Resource::loadIconSet("s_hidden"),"",this,"hideButton"); + hideButton->setGeometry(140,4,25,25); + connect( hideButton,SIGNAL(toggled(bool)),this,SLOT( hideButtonPushed(bool)) ); + hideButton->setToggleButton(TRUE); + hideButton->setFlat(TRUE); + ListView = new QListView( this, "ListView" ); ListView->addColumn( tr( "Name" ) ); @@ -74,4 +85,5 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl // qDebug( tmpFileName); currentDir.setPath( QDir::currentDirPath() ); + currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); populateList(); move(0,15); @@ -86,5 +98,4 @@ void fileSaver::populateList() { ListView->clear(); - currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentDir.setMatchAllDirs(TRUE); @@ -201,2 +212,22 @@ void fileSaver::homeButtonPushed() { update(); } +void fileSaver::docButtonPushed() { + chdir( QString(QPEApplication::documentDir()+"/text").latin1() ); + currentDir.cd( QPEApplication::documentDir()+"/text", TRUE); + populateList(); + update(); + +} + +void fileSaver::hideButtonPushed(bool b) { + if (b) + currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + else + currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + +// chdir( QString(QPEApplication::documentDir()+"/text").latin1() ); +// currentDir.cd( QPEApplication::documentDir()+"/text", TRUE); + populateList(); + update(); + +} diff --git a/core/apps/textedit/fileSaver.h b/core/apps/textedit/fileSaver.h index 526085d..195a775 100644 --- a/core/apps/textedit/fileSaver.h +++ b/core/apps/textedit/fileSaver.h @@ -44,7 +44,6 @@ public: QLineEdit *fileEdit; - QPushButton* buttonOk; + QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton; QListView* ListView; - QPushButton* buttonCancel; QLabel *dirLabel; QString selectedFileName, filterStr; @@ -56,5 +55,7 @@ public: QListViewItem * item; public slots: -void homeButtonPushed(); + void homeButtonPushed(); + void docButtonPushed(); + void hideButtonPushed(bool); private: diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 78c4d8a..dafe1dc 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -562,5 +562,6 @@ void TextEdit::newFileOpen() edited1=FALSE; edited=FALSE; - setCaption(caption().right(caption().length()-1)); + if(caption().left(1)=="*") + setCaption(caption().right(caption().length()-1)); } @@ -693,5 +694,4 @@ void TextEdit::openFile( const DocLnk &f ) edited1=FALSE; edited=FALSE; - setCaption(caption().right(caption().length()-1)); qDebug("openFile doclnk "+currentFileName); |