summaryrefslogtreecommitdiff
authorbipolar <bipolar>2002-03-01 14:49:41 (UTC)
committer bipolar <bipolar>2002-03-01 14:49:41 (UTC)
commit2dfc5c76379baf8ae8ad6aed5f6c44d59d79087b (patch) (unidiff)
treed4b0572e3204ab4b7bdacde937bca46392182f75
parent38e7dc570dfbcea350795d9cf8f66b643ad159a8 (diff)
downloadopie-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.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp22
-rw-r--r--core/apps/textedit/fileBrowser.h2
-rw-r--r--core/apps/textedit/fileSaver.cpp29
-rw-r--r--core/apps/textedit/fileSaver.h2
-rw-r--r--core/apps/textedit/textedit.cpp3
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
@@ -10,30 +10,38 @@
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13****************************************************************************/ 13****************************************************************************/
14#include "fileBrowser.h" 14#include "fileBrowser.h"
15#include <qpe/config.h> 15#include <qpe/config.h>
16#include <qpe/resource.h>
16 17
17#include <qlistview.h> 18#include <qlistview.h>
18#include <qpushbutton.h> 19#include <qpushbutton.h>
19#include <qfile.h> 20#include <qfile.h>
20#include <qmessagebox.h> 21#include <qmessagebox.h>
21#include <unistd.h> 22#include <unistd.h>
22 23
23fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) 24fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter )
24 : QDialog( parent, name, modal, fl ) 25 : QDialog( parent, name, modal, fl )
25{ 26{
26 if ( !name ) 27 if ( !name )
27 setName( "fileBrowser" ); 28 setName( "fileBrowser" );
28 resize( 236, 280 ); 29 resize( 240, 280 );
29 setCaption(tr( "Browse for file" ) ); 30 setCaption(tr( "Browse for file" ) );
30 filterStr=filter; 31 filterStr=filter;
32
31 dirLabel = new QLabel(this, "DirLabel"); 33 dirLabel = new QLabel(this, "DirLabel");
32 dirLabel->setText(currentDir.canonicalPath()); 34 dirLabel->setText(currentDir.canonicalPath());
33 dirLabel->setGeometry(10,4,230,30); 35 dirLabel->setGeometry(10,20,230,15);
36
37 QPushButton *homeButton;
38 homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton");
39 homeButton->setGeometry(200,4,25,25);
40 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
41
34 ListView = new QListView( this, "ListView" ); 42 ListView = new QListView( this, "ListView" );
35 ListView->addColumn( tr( "Name" ) ); 43 ListView->addColumn( tr( "Name" ) );
36 ListView->setColumnWidth(0,140); 44 ListView->setColumnWidth(0,140);
37 ListView->setSorting( 2, FALSE); 45 ListView->setSorting( 2, FALSE);
38 ListView->addColumn( tr( "Size" ) ); 46 ListView->addColumn( tr( "Size" ) );
39 ListView->setColumnWidth(1,59); 47 ListView->setColumnWidth(1,59);
@@ -48,12 +56,13 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
48 56
49 // signals and slots connections 57 // signals and slots connections
50 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); 58 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) );
51 connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 59 connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
52 currentDir.setPath(QDir::currentDirPath()); 60 currentDir.setPath(QDir::currentDirPath());
53 populateList(); 61 populateList();
62 move(0,15);
54} 63}
55 64
56fileBrowser::~fileBrowser() 65fileBrowser::~fileBrowser()
57{ 66{
58} 67}
59 68
@@ -91,13 +100,13 @@ void fileBrowser::populateList()
91 } 100 }
92 } 101 }
93 item= new QListViewItem( ListView,fileL,fileS ); 102 item= new QListViewItem( ListView,fileL,fileS );
94 ++it; 103 ++it;
95 } 104 }
96 ListView->setSorting( 2, FALSE); 105 ListView->setSorting( 2, FALSE);
97 dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); 106 dirLabel->setText(currentDir.canonicalPath());
98} 107}
99 108
100void fileBrowser::upDir() 109void fileBrowser::upDir()
101{ 110{
102// qDebug(currentDir.canonicalPath()); 111// qDebug(currentDir.canonicalPath());
103} 112}
@@ -159,6 +168,13 @@ void fileBrowser::OnOK()
159 qDebug("selected filename is "+selectedFileName); 168 qDebug("selected filename is "+selectedFileName);
160 fileList.append( selectedFileName ); 169 fileList.append( selectedFileName );
161 } 170 }
162 } 171 }
163 accept(); 172 accept();
164} 173}
174
175void fileBrowser::homeButtonPushed() {
176 chdir( QDir::homeDirPath().latin1() );
177 currentDir.cd( QDir::homeDirPath(), TRUE);
178 populateList();
179 update();
180}
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
@@ -47,13 +47,13 @@ public:
47 QDir currentDir; 47 QDir currentDir;
48 QFile file; 48 QFile file;
49 QStringList fileList; 49 QStringList fileList;
50 50
51QListViewItem * item; 51QListViewItem * item;
52public slots: 52public slots:
53 53void homeButtonPushed();
54private: 54private:
55 55
56private slots: 56private slots:
57 void upDir(); 57 void upDir();
58 void listDoubleClicked(QListViewItem *); 58 void listDoubleClicked(QListViewItem *);
59 void listClicked(QListViewItem *); 59 void listClicked(QListViewItem *);
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
@@ -10,12 +10,14 @@
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13****************************************************************************/ 13****************************************************************************/
14#include "fileSaver.h" 14#include "fileSaver.h"
15#include <qpe/config.h> 15#include <qpe/config.h>
16#include <qpe/resource.h>
17
16#include <qpe/qpeapplication.h> 18#include <qpe/qpeapplication.h>
17#include <qlistview.h> 19#include <qlistview.h>
18#include <qpushbutton.h> 20#include <qpushbutton.h>
19#include <qfile.h> 21#include <qfile.h>
20#include <qmessagebox.h> 22#include <qmessagebox.h>
21#include <qlineedit.h> 23#include <qlineedit.h>
@@ -25,52 +27,58 @@
25 27
26fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl , const QString currentFileName ) 28fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl , const QString currentFileName )
27 : QDialog( parent, name, modal, fl ) 29 : QDialog( parent, name, modal, fl )
28{ 30{
29 if ( !name ) 31 if ( !name )
30 setName( "fileSaver" ); 32 setName( "fileSaver" );
31 resize( 236, 280 ); 33 resize( 240, 280 );
32 setCaption(tr( "Save file" ) ); 34 setCaption(tr( "Save file" ) );
33 QFileInfo fi(currentFileName); 35 QFileInfo fi(currentFileName);
34 QString tmpFileName=fi.fileName(); 36 QString tmpFileName=fi.fileName();
35// qDebug( tmpFileName); 37// qDebug( tmpFileName);
36
37 dirLabel = new QLabel(this, "DirLabel"); 38 dirLabel = new QLabel(this, "DirLabel");
38 dirLabel->setText(currentDir.canonicalPath()); 39 dirLabel->setText(currentDir.canonicalPath());
39 dirLabel->setGeometry(10,4,230,30); 40 dirLabel->setGeometry(10,20,230,15);
40 41
42 QPushButton *homeButton;
43 homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton");
44 homeButton->setGeometry(200,4,25,25);
45 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
46
41 ListView = new QListView( this, "ListView" ); 47 ListView = new QListView( this, "ListView" );
42 ListView->addColumn( tr( "Name" ) ); 48 ListView->addColumn( tr( "Name" ) );
43 ListView->setColumnWidth(0,140); 49 ListView->setColumnWidth(0,140);
44 ListView->setSorting( 2, FALSE); 50 ListView->setSorting( 2, FALSE);
45 ListView->addColumn( tr( "Size" ) ); 51 ListView->addColumn( tr( "Size" ) );
46 ListView->setColumnWidth(1,59); 52 ListView->setColumnWidth(1,59);
47 ListView->setColumnWidthMode(0,QListView::Manual); 53 ListView->setColumnWidthMode(0,QListView::Manual);
48 ListView->setColumnAlignment(1,QListView::AlignRight); 54 ListView->setColumnAlignment(1,QListView::AlignRight);
49// ListView->setMultiSelection(true); 55// ListView->setMultiSelection(true);
50// ListView->setSelectionMode(QListView::Extended); 56// ListView->setSelectionMode(QListView::Extended);
51 57
52 ListView->setAllColumnsShowFocus( TRUE ); 58 ListView->setAllColumnsShowFocus( TRUE );
53 ListView->setGeometry( QRect( 10, 35, 220, 160 ) ); 59 ListView->setGeometry( QRect( 10,35,220,125));
54 60
55 fileEdit= new QLineEdit(this); 61 fileEdit= new QLineEdit(this);
56 fileEdit->setGeometry( QRect( 10, 200, 200, 22)); 62 fileEdit->setGeometry( QRect( 10, 162, 205, 17));
57 63
58 fileEdit->setText( tmpFileName); 64 fileEdit->setText( tmpFileName);
59 65
60 filePermCheck = new QCheckBox( this, "SetFilePerms" ); 66 filePermCheck = new QCheckBox( this, "SetFilePerms" );
61 filePermCheck->setText("set file permissions"); 67 filePermCheck->setText("set file permissions");
62 filePermCheck->setGeometry(10, 220, 150,22); 68 filePermCheck->setGeometry(10, 178, 150,17);
63 // signals and slots connections 69 // signals and slots connections
64 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); 70 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) );
65 connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 71 connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
66 72
67// tmpFileName=fi.FilePath(); 73// tmpFileName=fi.FilePath();
68// qDebug( tmpFileName); 74// qDebug( tmpFileName);
69 currentDir.setPath( QDir::currentDirPath() ); 75 currentDir.setPath( QDir::currentDirPath() );
70 populateList(); 76 populateList();
77 move(0,15);
78
71} 79}
72 80
73fileSaver::~fileSaver() 81fileSaver::~fileSaver()
74{ 82{
75} 83}
76 84
@@ -106,13 +114,13 @@ void fileSaver::populateList()
106 } 114 }
107 } 115 }
108 item= new QListViewItem( ListView,fileL,fileS ); 116 item= new QListViewItem( ListView,fileL,fileS );
109 ++it; 117 ++it;
110 } 118 }
111 ListView->setSorting( 2, FALSE); 119 ListView->setSorting( 2, FALSE);
112 dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); 120 dirLabel->setText(currentDir.canonicalPath());
113 121
114 122
115} 123}
116 124
117void fileSaver::upDir() 125void fileSaver::upDir()
118{ 126{
@@ -183,6 +191,13 @@ void fileSaver::accept() {
183 } else { 191 } else {
184 selectedFileName = currentDir.canonicalPath()+selectedFileName; 192 selectedFileName = currentDir.canonicalPath()+selectedFileName;
185 } 193 }
186 qDebug("going to save "+selectedFileName); 194 qDebug("going to save "+selectedFileName);
187 done(1); 195 done(1);
188} 196}
197
198void fileSaver::homeButtonPushed() {
199 chdir( QDir::homeDirPath().latin1() );
200 currentDir.cd( QDir::homeDirPath(), TRUE);
201 populateList();
202 update();
203}
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
@@ -52,13 +52,13 @@ public:
52 QFile file; 52 QFile file;
53 QStringList fileList; 53 QStringList fileList;
54 QCheckBox *filePermCheck; 54 QCheckBox *filePermCheck;
55 55
56QListViewItem * item; 56QListViewItem * item;
57public slots: 57public slots:
58 58void homeButtonPushed();
59private: 59private:
60 60
61private slots: 61private slots:
62 void accept(); 62 void accept();
63 void upDir(); 63 void upDir();
64 void listDoubleClicked(QListViewItem *); 64 void listDoubleClicked(QListViewItem *);
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
@@ -760,13 +760,13 @@ bool TextEdit::saveAs()
760 doc->setName(docname); 760 doc->setName(docname);
761 currentFileName=docname; 761 currentFileName=docname;
762 } 762 }
763 } 763 }
764 764
765 765
766 fileSaveDlg=new fileSaver(this,"SaveFile",TRUE,0, currentFileName); 766 fileSaveDlg=new fileSaver(this,"SaveFile",TRUE, 0, currentFileName);
767 qDebug("wanna save filename "+currentFileName); 767 qDebug("wanna save filename "+currentFileName);
768 fileSaveDlg->exec(); 768 fileSaveDlg->exec();
769 if( fileSaveDlg->result() == 1 ) { 769 if( fileSaveDlg->result() == 1 ) {
770 QString fileNm=fileSaveDlg->selectedFileName; 770 QString fileNm=fileSaveDlg->selectedFileName;
771 qDebug("saving filename "+fileNm); 771 qDebug("saving filename "+fileNm);
772 QFileInfo fi(fileNm); 772 QFileInfo fi(fileNm);
@@ -886,12 +886,13 @@ void TextEdit::editDelete()
886{ 886{
887 switch ( QMessageBox::warning(this,"Text Editor","Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!","Yes","No",0,0,1) ) { 887 switch ( QMessageBox::warning(this,"Text Editor","Do you really want\nto delete the current file\nfrom the disk?\nThis is irreversable!!","Yes","No",0,0,1) ) {
888 case 0: 888 case 0:
889 if(doc) { 889 if(doc) {
890 doc->removeFiles(); 890 doc->removeFiles();
891 clear(); 891 clear();
892 setCaption( tr("Text Editor") );
892 } 893 }
893 break; 894 break;
894 case 1: 895 case 1:
895 // exit 896 // exit
896 break; 897 break;
897 }; 898 };