author | drw <drw> | 2002-03-15 01:09:57 (UTC) |
---|---|---|
committer | drw <drw> | 2002-03-15 01:09:57 (UTC) |
commit | 320291b5006c75e3e42ba1cbbac9639a54309553 (patch) (side-by-side diff) | |
tree | 0cfd5d74be6598c778dc94688797cf47cdf6c9d6 | |
parent | 5283a32d6d9ab9b9bccd3482ab6694c940c874d3 (diff) | |
download | opie-320291b5006c75e3e42ba1cbbac9639a54309553.zip opie-320291b5006c75e3e42ba1cbbac9639a54309553.tar.gz opie-320291b5006c75e3e42ba1cbbac9639a54309553.tar.bz2 |
Made file browser resize
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 46 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 1 |
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 @@ ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #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 <qlayout.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 ) - setName( "fileBrowser" ); - resize( 240, 280 ); + setName( "fileBrowser" ); setCaption(tr( name ) ); filterStr=filter; + QGridLayout *layout = new QGridLayout( this ); + layout->setSpacing( 4 ); + layout->setMargin( 4 ); + + dirLabel = new QLabel(this, "DirLabel"); dirLabel->setText(currentDir.canonicalPath()); - dirLabel->setGeometry(10,20,230,15); + dirLabel->setMinimumSize( QSize( 50, 15 ) ); + dirLabel->setMaximumSize( QSize( 250, 15 ) ); + layout->addWidget( dirLabel, 0, 0 ); - homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); - homeButton->setGeometry(200,4,25,25); - connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); - homeButton->setFlat(TRUE); + hideButton = new QPushButton( Resource::loadIconSet("s_hidden"),"",this,"hideButton"); + hideButton->setMinimumSize( QSize( 25, 25 ) ); + hideButton->setMaximumSize( QSize( 25, 25 ) ); + connect( hideButton,SIGNAL(toggled(bool)),this,SLOT( hideButtonPushed(bool)) ); + hideButton->setToggleButton(TRUE); + hideButton->setFlat(TRUE); + layout->addWidget( hideButton, 0, 1 ); docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); - docButton->setGeometry(170,4,25,25); + docButton->setMinimumSize( QSize( 25, 25 ) ); + docButton->setMaximumSize( QSize( 25, 25 ) ); connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); docButton->setFlat(TRUE); + layout->addWidget( docButton, 0, 2 ); + + homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); + homeButton->setMinimumSize( QSize( 25, 25 ) ); + homeButton->setMaximumSize( QSize( 25, 25 ) ); + connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); + homeButton->setFlat(TRUE); + layout->addWidget( homeButton, 0, 3 ); - 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->setMinimumSize( QSize( 100, 25 ) ); ListView->addColumn( tr( "Name" ) ); ListView->setColumnWidth(0,140); ListView->setSorting( 2, FALSE); ListView->addColumn( tr( "Size" ) ); ListView->setColumnWidth(1,59); // ListView->addColumn( tr( "" ) ); ListView->setColumnWidthMode(0,QListView::Manual); ListView->setColumnAlignment(1,QListView::AlignRight); // ListView->setMultiSelection(true); // ListView->setSelectionMode(QListView::Extended); ListView->setAllColumnsShowFocus( TRUE ); - ListView->setGeometry( QRect( 10, 35, 220, 240 ) ); + layout->addMultiCellWidget( ListView, 1, 1, 0, 3 ); // 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); + move(0,15); } fileBrowser::~fileBrowser() { } void fileBrowser::populateList() { ListView->clear(); //qDebug(currentDir.canonicalPath()); currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentDir.setMatchAllDirs(TRUE); currentDir.setNameFilter(filterStr); // 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() // delete doc; // doc = 0; // } // } menu->hide(); editBar->hide(); searchBar->hide(); clearWState (WState_Reserved1 ); editorStack->raiseWidget( fileSelector ); fileSelector->reread(); updateCaption(); } void TextEdit::newFileOpen() { browseForFiles=new fileBrowser(this,"Open File",TRUE,0, "*"); + browseForFiles->showMaximized(); if( browseForFiles->exec() != -1 ) { QString selFile= browseForFiles->selectedFileName; QStringList fileList=browseForFiles->fileList; qDebug(selFile); QStringList::ConstIterator f; QString fileTemp; for ( f = fileList.begin(); f != fileList.end(); f++ ) { fileTemp = *f; fileTemp.right( fileTemp.length()-5); QString fileName = fileTemp; if( fileName != "Unnamed" || fileName != "Empty Text" ) { currentFileName = fileName; qDebug("please open "+currentFileName); openFile(fileName ); } } |