summaryrefslogtreecommitdiff
path: root/noncore/settings/packagemanager/entrydlg.cpp
Unidiff
Diffstat (limited to 'noncore/settings/packagemanager/entrydlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/entrydlg.cpp74
1 files changed, 48 insertions, 26 deletions
diff --git a/noncore/settings/packagemanager/entrydlg.cpp b/noncore/settings/packagemanager/entrydlg.cpp
index fd275e1..3b794b4 100644
--- a/noncore/settings/packagemanager/entrydlg.cpp
+++ b/noncore/settings/packagemanager/entrydlg.cpp
@@ -1,27 +1,27 @@
1/* 1/*
2                This file is part of the OPIE Project 2 This file is part of the OPIE Project
3 3
4 =. Copyright (c) 2004 Dan Williams <drw@handhelds.org> 4 =. Copyright (c) 2004 Dan Williams <drw@handhelds.org>
5             .=l. 5 .=l.
6           .>+-= 6 .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7_;:, .> :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.-- : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13    .%`+i>       _;_. 13 .%`+i> _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14 .i_,=:_. -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.= = ; Public License for more details.
20++=   -.     .`     .: 20++= -. .` .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21: = ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22-. .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23 -_. . . )=. = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24 -- :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
@@ -29,7 +29,10 @@
29 29
30#include "entrydlg.h" 30#include "entrydlg.h"
31 31
32#include <opie2/ofiledialog.h>
33
32#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/resource.h>
33 36
34#include <qlabel.h> 37#include <qlabel.h>
35#include <qlayout.h> 38#include <qlayout.h>
@@ -39,16 +42,26 @@
39EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal ) 42EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal )
40 : QDialog( parent, name, modal ) 43 : QDialog( parent, name, modal )
41{ 44{
42 QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); 45 QGridLayout *layout = new QGridLayout( this, 3, 2, 2, 4 );
43 46
44 QLabel *l = new QLabel( label, this ); 47 QLabel *l = new QLabel( label, this );
45 l->setAlignment( AlignLeft | AlignTop | WordBreak ); 48 l->setAlignment( AlignLeft | AlignTop | WordBreak );
46 vbox->addWidget( l ); 49 layout->addMultiCellWidget( l, 0, 0, 0, 1 );
47 50
48 m_entry = new QLineEdit( this ); 51 m_entry = new QLineEdit( this );
49 vbox->addWidget( m_entry ); 52 layout->addWidget( m_entry, 1, 0 );
53 connect( m_entry, SIGNAL(returnPressed()), this, SLOT(slotTryAccept()) );
54
55 QPixmap pic;
56 pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
57 QPushButton *btn = new QPushButton( pic, QString::null, this );
58 btn->setMaximumWidth( btn->height() );
59 connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) );
60 layout->addWidget( btn, 1, 1 );
61
62 layout->setRowStretch( 2, 10 );
50 63
51 connect( m_entry, SIGNAL(returnPressed()), this, SLOT(tryAccept()) ); 64 resize( width(), l->height() + btn->height() + 8 );
52} 65}
53 66
54void EntryDlg::setText( const QString &text ) 67void EntryDlg::setText( const QString &text )
@@ -78,8 +91,17 @@ QString EntryDlg::getText( const QString &caption, const QString &label, const Q
78 delete dlg; 91 delete dlg;
79 return result; 92 return result;
80} 93}
81void EntryDlg::tryAccept() 94void EntryDlg::slotTryAccept()
82{ 95{
83 if ( !m_entry->text().isEmpty() ) 96 if ( !m_entry->text().isEmpty() )
84 accept(); 97 accept();
85} 98}
99
100void EntryDlg::slotSelectPath()
101{
102 QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_entry->text() );
103 if ( path.at( path.length() - 1 ) == '/' )
104 path.truncate( path.length() - 1 );
105 if ( !path.isNull() )
106 m_entry->setText( path );
107}