summaryrefslogtreecommitdiff
authordrw <drw>2002-03-15 01:09:57 (UTC)
committer drw <drw>2002-03-15 01:09:57 (UTC)
commit320291b5006c75e3e42ba1cbbac9639a54309553 (patch) (unidiff)
tree0cfd5d74be6598c778dc94688797cf47cdf6c9d6
parent5283a32d6d9ab9b9bccd3482ab6694c940c874d3 (diff)
downloadopie-320291b5006c75e3e42ba1cbbac9639a54309553.zip
opie-320291b5006c75e3e42ba1cbbac9639a54309553.tar.gz
opie-320291b5006c75e3e42ba1cbbac9639a54309553.tar.bz2
Made file browser resize
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp46
-rw-r--r--core/apps/textedit/textedit.cpp1
2 files changed, 31 insertions, 16 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index c16bd41..2e88067 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -7,88 +7,102 @@
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
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#include <qpe/resource.h>
17#include <qpe/qpeapplication.h> 17#include <qpe/qpeapplication.h>
18 18
19#include <qlistview.h> 19#include <qlistview.h>
20#include <qpushbutton.h> 20#include <qpushbutton.h>
21#include <qfile.h> 21#include <qfile.h>
22#include <qmessagebox.h> 22#include <qmessagebox.h>
23#include <qlayout.h>
23#include <unistd.h> 24#include <unistd.h>
24 25
25 26
26 27
27fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter ) 28fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter )
28 : QDialog( parent, name, modal, fl ) 29 : QDialog( parent, name, modal, fl )
29{ 30{
30 if ( !name ) 31 if ( !name )
31 setName( "fileBrowser" ); 32 setName( "fileBrowser" );
32 resize( 240, 280 );
33 setCaption(tr( name ) ); 33 setCaption(tr( name ) );
34 filterStr=filter; 34 filterStr=filter;
35 35
36 QGridLayout *layout = new QGridLayout( this );
37 layout->setSpacing( 4 );
38 layout->setMargin( 4 );
39
40
36 dirLabel = new QLabel(this, "DirLabel"); 41 dirLabel = new QLabel(this, "DirLabel");
37 dirLabel->setText(currentDir.canonicalPath()); 42 dirLabel->setText(currentDir.canonicalPath());
38 dirLabel->setGeometry(10,20,230,15); 43 dirLabel->setMinimumSize( QSize( 50, 15 ) );
44 dirLabel->setMaximumSize( QSize( 250, 15 ) );
45 layout->addWidget( dirLabel, 0, 0 );
39 46
40 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); 47 hideButton = new QPushButton( Resource::loadIconSet("s_hidden"),"",this,"hideButton");
41 homeButton->setGeometry(200,4,25,25); 48 hideButton->setMinimumSize( QSize( 25, 25 ) );
42 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 49 hideButton->setMaximumSize( QSize( 25, 25 ) );
43 homeButton->setFlat(TRUE); 50 connect( hideButton,SIGNAL(toggled(bool)),this,SLOT( hideButtonPushed(bool)) );
51 hideButton->setToggleButton(TRUE);
52 hideButton->setFlat(TRUE);
53 layout->addWidget( hideButton, 0, 1 );
44 54
45 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 55 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
46 docButton->setGeometry(170,4,25,25); 56 docButton->setMinimumSize( QSize( 25, 25 ) );
57 docButton->setMaximumSize( QSize( 25, 25 ) );
47 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 58 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
48 docButton->setFlat(TRUE); 59 docButton->setFlat(TRUE);
60 layout->addWidget( docButton, 0, 2 );
61
62 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
63 homeButton->setMinimumSize( QSize( 25, 25 ) );
64 homeButton->setMaximumSize( QSize( 25, 25 ) );
65 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
66 homeButton->setFlat(TRUE);
67 layout->addWidget( homeButton, 0, 3 );
49 68
50 hideButton = new QPushButton( Resource::loadIconSet("s_hidden"),"",this,"hideButton");
51 hideButton->setGeometry(140,4,25,25);
52 connect( hideButton,SIGNAL(toggled(bool)),this,SLOT( hideButtonPushed(bool)) );
53 hideButton->setToggleButton(TRUE);
54 hideButton->setFlat(TRUE);
55
56 ListView = new QListView( this, "ListView" ); 69 ListView = new QListView( this, "ListView" );
70 ListView->setMinimumSize( QSize( 100, 25 ) );
57 ListView->addColumn( tr( "Name" ) ); 71 ListView->addColumn( tr( "Name" ) );
58 ListView->setColumnWidth(0,140); 72 ListView->setColumnWidth(0,140);
59 ListView->setSorting( 2, FALSE); 73 ListView->setSorting( 2, FALSE);
60 ListView->addColumn( tr( "Size" ) ); 74 ListView->addColumn( tr( "Size" ) );
61 ListView->setColumnWidth(1,59); 75 ListView->setColumnWidth(1,59);
62// ListView->addColumn( tr( "" ) ); 76// ListView->addColumn( tr( "" ) );
63 ListView->setColumnWidthMode(0,QListView::Manual); 77 ListView->setColumnWidthMode(0,QListView::Manual);
64 ListView->setColumnAlignment(1,QListView::AlignRight); 78 ListView->setColumnAlignment(1,QListView::AlignRight);
65// ListView->setMultiSelection(true); 79// ListView->setMultiSelection(true);
66// ListView->setSelectionMode(QListView::Extended); 80// ListView->setSelectionMode(QListView::Extended);
67 81
68 ListView->setAllColumnsShowFocus( TRUE ); 82 ListView->setAllColumnsShowFocus( TRUE );
69 ListView->setGeometry( QRect( 10, 35, 220, 240 ) ); 83 layout->addMultiCellWidget( ListView, 1, 1, 0, 3 );
70 84
71 // signals and slots connections 85 // signals and slots connections
72 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); 86 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) );
73 connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); 87 connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
74 currentDir.setPath(QDir::currentDirPath()); 88 currentDir.setPath(QDir::currentDirPath());
75 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); 89 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All);
76 90
77 populateList(); 91 populateList();
78 move(0,15); 92 move(0,15);
79} 93}
80 94
81fileBrowser::~fileBrowser() 95fileBrowser::~fileBrowser()
82{ 96{
83} 97}
84 98
85 99
86void fileBrowser::populateList() 100void fileBrowser::populateList()
87{ 101{
88 ListView->clear(); 102 ListView->clear();
89//qDebug(currentDir.canonicalPath()); 103//qDebug(currentDir.canonicalPath());
90 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 104 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
91 currentDir.setMatchAllDirs(TRUE); 105 currentDir.setMatchAllDirs(TRUE);
92 106
93 currentDir.setNameFilter(filterStr); 107 currentDir.setNameFilter(filterStr);
94// currentDir.setNameFilter("*.txt;*.etx"); 108// currentDir.setNameFilter("*.txt;*.etx");
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index c46f089..3a189cb 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -527,32 +527,33 @@ void TextEdit::fileOpen()
527// delete doc; 527// delete doc;
528// doc = 0; 528// doc = 0;
529// } 529// }
530// } 530// }
531 menu->hide(); 531 menu->hide();
532 editBar->hide(); 532 editBar->hide();
533 searchBar->hide(); 533 searchBar->hide();
534 clearWState (WState_Reserved1 ); 534 clearWState (WState_Reserved1 );
535 editorStack->raiseWidget( fileSelector ); 535 editorStack->raiseWidget( fileSelector );
536 fileSelector->reread(); 536 fileSelector->reread();
537 updateCaption(); 537 updateCaption();
538} 538}
539 539
540void TextEdit::newFileOpen() 540void TextEdit::newFileOpen()
541{ 541{
542 browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*"); 542 browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*");
543 browseForFiles->showMaximized();
543 if( browseForFiles->exec() != -1 ) { 544 if( browseForFiles->exec() != -1 ) {
544 QString selFile= browseForFiles->selectedFileName; 545 QString selFile= browseForFiles->selectedFileName;
545 QStringList fileList=browseForFiles->fileList; 546 QStringList fileList=browseForFiles->fileList;
546 qDebug(selFile); 547 qDebug(selFile);
547 QStringList::ConstIterator f; 548 QStringList::ConstIterator f;
548 QString fileTemp; 549 QString fileTemp;
549 for ( f = fileList.begin(); f != fileList.end(); f++ ) { 550 for ( f = fileList.begin(); f != fileList.end(); f++ ) {
550 fileTemp = *f; 551 fileTemp = *f;
551 fileTemp.right( fileTemp.length()-5); 552 fileTemp.right( fileTemp.length()-5);
552 QString fileName = fileTemp; 553 QString fileName = fileTemp;
553 if( fileName != "Unnamed" || fileName != "Empty Text" ) { 554 if( fileName != "Unnamed" || fileName != "Empty Text" ) {
554 currentFileName = fileName; 555 currentFileName = fileName;
555 qDebug("please open "+currentFileName); 556 qDebug("please open "+currentFileName);
556 openFile(fileName ); 557 openFile(fileName );
557 } 558 }
558 } 559 }