summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-10 03:22:06 (UTC)
committer llornkcor <llornkcor>2002-03-10 03:22:06 (UTC)
commit115b05c0aa6e11d8a0265f2e6806bdf9d03a404a (patch) (side-by-side diff)
tree2d1648da4632fa2d248159a26abf2da30dff379e
parent637cea2664defb5414a3897f70b616deba926ffe (diff)
downloadopie-115b05c0aa6e11d8a0265f2e6806bdf9d03a404a.zip
opie-115b05c0aa6e11d8a0265f2e6806bdf9d03a404a.tar.gz
opie-115b05c0aa6e11d8a0265f2e6806bdf9d03a404a.tar.bz2
added a documents and hidden file buttons to fileSaver and fileBrowser
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp40
-rw-r--r--core/apps/textedit/fileBrowser.h7
-rw-r--r--core/apps/textedit/fileSaver.cpp35
-rw-r--r--core/apps/textedit/fileSaver.h5
-rw-r--r--core/apps/textedit/textedit.cpp2
5 files changed, 79 insertions, 10 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
@@ -13,15 +13,18 @@
****************************************************************************/
#include "fileBrowser.h"
#include <qpe/config.h>
#include <qpe/resource.h>
+#include <qpe/qpeapplication.h>
#include <qlistview.h>
#include <qpushbutton.h>
#include <qfile.h>
#include <qmessagebox.h>
#include <unistd.h>
+
+
fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter )
: QDialog( parent, name, modal, fl )
{
if ( !name )
@@ -33,12 +36,23 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
dirLabel = new QLabel(this, "DirLabel");
dirLabel->setText(currentDir.canonicalPath());
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" ) );
ListView->setColumnWidth(0,140);
@@ -57,8 +71,10 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
// signals and slots connections
connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) );
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);
}
@@ -70,9 +86,8 @@ fileBrowser::~fileBrowser()
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);
currentDir.setNameFilter(filterStr);
@@ -177,4 +192,25 @@ void fileBrowser::homeButtonPushed() {
currentDir.cd( QDir::homeDirPath(), TRUE);
populateList();
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
@@ -38,20 +38,21 @@ public:
void populateList();
fileBrowser( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0);
~fileBrowser();
- QPushButton* buttonOk;
+ QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton;
QListView* ListView;
- QPushButton* buttonCancel;
+
QLabel *dirLabel;
QString selectedFileName, filterStr;
QDir currentDir;
QFile file;
QStringList fileList;
-
QListViewItem * item;
public slots:
void homeButtonPushed();
+ void docButtonPushed();
+ void hideButtonPushed(bool);
private:
private slots:
void upDir();
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
@@ -38,12 +38,23 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl
dirLabel = new QLabel(this, "DirLabel");
dirLabel->setText(currentDir.canonicalPath());
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" ) );
ListView->setColumnWidth(0,140);
@@ -72,8 +83,9 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl
// tmpFileName=fi.FilePath();
// qDebug( tmpFileName);
currentDir.setPath( QDir::currentDirPath() );
+ currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All);
populateList();
move(0,15);
fileEdit->setFocus();
}
@@ -84,9 +96,8 @@ fileSaver::~fileSaver()
void fileSaver::populateList()
{
ListView->clear();
- currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden );
currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
currentDir.setMatchAllDirs(TRUE);
currentDir.setNameFilter("*");
@@ -199,4 +210,24 @@ void fileSaver::homeButtonPushed() {
currentDir.cd( QDir::homeDirPath(), TRUE);
populateList();
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
@@ -42,11 +42,10 @@ public:
fileSaver( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ,const QString filter=0);
~fileSaver();
QLineEdit *fileEdit;
- QPushButton* buttonOk;
+ QPushButton *buttonOk, *buttonCancel, *homeButton, *docButton, *hideButton;
QListView* ListView;
- QPushButton* buttonCancel;
QLabel *dirLabel;
QString selectedFileName, filterStr;
QDir currentDir;
QFile file;
@@ -55,8 +54,10 @@ public:
QListViewItem * item;
public slots:
void homeButtonPushed();
+ void docButtonPushed();
+ void hideButtonPushed(bool);
private:
private slots:
void accept();
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
@@ -560,8 +560,9 @@ void TextEdit::newFileOpen()
delete browseForFiles;
editor->setEdited( FALSE);
edited1=FALSE;
edited=FALSE;
+ if(caption().left(1)=="*")
setCaption(caption().right(caption().length()-1));
}
#if 0
@@ -691,9 +692,8 @@ void TextEdit::openFile( const DocLnk &f )
editor->setText(txt);
editor->setEdited( FALSE);
edited1=FALSE;
edited=FALSE;
- setCaption(caption().right(caption().length()-1));
qDebug("openFile doclnk "+currentFileName);
doc->setName(currentFileName);
updateCaption();