author | llornkcor <llornkcor> | 2002-03-10 03:22:06 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-10 03:22:06 (UTC) |
commit | 115b05c0aa6e11d8a0265f2e6806bdf9d03a404a (patch) (side-by-side diff) | |
tree | 2d1648da4632fa2d248159a26abf2da30dff379e | |
parent | 637cea2664defb5414a3897f70b616deba926ffe (diff) | |
download | opie-115b05c0aa6e11d8a0265f2e6806bdf9d03a404a.zip opie-115b05c0aa6e11d8a0265f2e6806bdf9d03a404a.tar.gz opie-115b05c0aa6e11d8a0265f2e6806bdf9d03a404a.tar.bz2 |
added a documents and hidden file buttons to fileSaver and fileBrowser
-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 @@ -16,2 +16,3 @@ #include <qpe/resource.h> +#include <qpe/qpeapplication.h> @@ -23,2 +24,4 @@ + + fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) @@ -36,7 +39,18 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags - 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" ); @@ -60,2 +74,4 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags currentDir.setPath(QDir::currentDirPath()); + currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); + populateList(); @@ -73,3 +89,2 @@ void fileBrowser::populateList() //qDebug(currentDir.canonicalPath()); - currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); @@ -180 +195,22 @@ void fileBrowser::homeButtonPushed() { } + +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 @@ -41,5 +41,5 @@ public: - QPushButton* buttonOk; + QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton; QListView* ListView; - QPushButton* buttonCancel; + QLabel *dirLabel; @@ -49,6 +49,7 @@ public: 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 @@ -41,3 +41,2 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl - QPushButton *homeButton; homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton"); @@ -45,3 +44,15 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl 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" ); @@ -75,2 +86,3 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl currentDir.setPath( QDir::currentDirPath() ); + currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); populateList(); @@ -87,3 +99,2 @@ void fileSaver::populateList() ListView->clear(); - currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); @@ -202 +213,21 @@ void fileSaver::homeButtonPushed() { } +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 @@ -45,5 +45,4 @@ public: - QPushButton* buttonOk; + QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton; QListView* ListView; - QPushButton* buttonCancel; QLabel *dirLabel; @@ -57,3 +56,5 @@ 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 @@ -563,3 +563,4 @@ void TextEdit::newFileOpen() edited=FALSE; - setCaption(caption().right(caption().length()-1)); + if(caption().left(1)=="*") + setCaption(caption().right(caption().length()-1)); } @@ -694,3 +695,2 @@ void TextEdit::openFile( const DocLnk &f ) edited=FALSE; - setCaption(caption().right(caption().length()-1)); |