-rw-r--r-- | noncore/settings/packagemanager/entrydlg.cpp | 74 | ||||
-rw-r--r-- | noncore/settings/packagemanager/entrydlg.h | 45 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 8 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 10 |
4 files changed, 85 insertions, 52 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,59 +1,72 @@ /* - This file is part of the OPIE Project + This file is part of the OPIE Project =. Copyright (c) 2004 Dan Williams <drw@handhelds.org> - .=l. - .>+-= - _;:, .> :=|. This file is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This file is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General -..}^=.= = ; Public License for more details. -++= -. .` .: - : = ...= . :.=- You should have received a copy of the GNU - -. .:....=;==+<; General Public License along with this file; - -_. . . )=. = see the file COPYING. If not, write to the - -- :-=` Free Software Foundation, Inc., + .=l. + .>+-= +_;:, .> :=|. This file is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This file is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General +..}^=.= = ; Public License for more details. +++= -. .` .: +: = ...= . :.=- You should have received a copy of the GNU +-. .:....=;==+<; General Public License along with this file; + -_. . . )=. = see the file COPYING. If not, write to the + -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "entrydlg.h" +#include <opie2/ofiledialog.h> + #include <qpe/qpeapplication.h> +#include <qpe/resource.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qpushbutton.h> EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal ) : QDialog( parent, name, modal ) { - QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); + QGridLayout *layout = new QGridLayout( this, 3, 2, 2, 4 ); QLabel *l = new QLabel( label, this ); l->setAlignment( AlignLeft | AlignTop | WordBreak ); - vbox->addWidget( l ); + layout->addMultiCellWidget( l, 0, 0, 0, 1 ); m_entry = new QLineEdit( this ); - vbox->addWidget( m_entry ); + layout->addWidget( m_entry, 1, 0 ); + connect( m_entry, SIGNAL(returnPressed()), this, SLOT(slotTryAccept()) ); + + QPixmap pic; + pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + QPushButton *btn = new QPushButton( pic, QString::null, this ); + btn->setMaximumWidth( btn->height() ); + connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) ); + layout->addWidget( btn, 1, 1 ); + + layout->setRowStretch( 2, 10 ); - connect( m_entry, SIGNAL(returnPressed()), this, SLOT(tryAccept()) ); + resize( width(), l->height() + btn->height() + 8 ); } void EntryDlg::setText( const QString &text ) { m_entry->setText( text ); m_entry->selectAll(); } @@ -73,13 +86,22 @@ QString EntryDlg::getText( const QString &caption, const QString &label, const Q *ok = ( QPEApplication::execDialog( dlg ) == QDialog::Accepted ); if ( *ok ) result = dlg->getText(); delete dlg; return result; } -void EntryDlg::tryAccept() +void EntryDlg::slotTryAccept() { if ( !m_entry->text().isEmpty() ) accept(); } + +void EntryDlg::slotSelectPath() +{ + QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_entry->text() ); + if ( path.at( path.length() - 1 ) == '/' ) + path.truncate( path.length() - 1 ); + if ( !path.isNull() ) + m_entry->setText( path ); +} diff --git a/noncore/settings/packagemanager/entrydlg.h b/noncore/settings/packagemanager/entrydlg.h index 33a7920..012589b 100644 --- a/noncore/settings/packagemanager/entrydlg.h +++ b/noncore/settings/packagemanager/entrydlg.h @@ -1,32 +1,32 @@ /* - This file is part of the OPIE Project + This file is part of the OPIE Project =. Copyright (c) 2004 Dan Williams <drw@handhelds.org> - .=l. - .>+-= - _;:, .> :=|. This file is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This file is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General -..}^=.= = ; Public License for more details. -++= -. .` .: - : = ...= . :.=- You should have received a copy of the GNU - -. .:....=;==+<; General Public License along with this file; - -_. . . )=. = see the file COPYING. If not, write to the - -- :-=` Free Software Foundation, Inc., + .=l. + .>+-= +_;:, .> :=|. This file is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This file is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General +..}^=.= = ; Public License for more details. +++= -. .` .: +: = ...= . :.=- You should have received a copy of the GNU +-. .:....=;==+<; General Public License along with this file; + -_. . . )=. = see the file COPYING. If not, write to the + -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ENTRYDLG_H #define ENTRYDLG_H @@ -43,15 +43,16 @@ public: bool *ok = 0, QWidget *parent = 0, const char *name = 0 ); EntryDlg( const QString &label, QWidget* parent = 0, const char* name = 0, bool modal = true ); void setText( const QString &text ); QString getText(); private slots: - void tryAccept(); + void slotTryAccept(); + void slotSelectPath(); private: QLineEdit *m_entry; }; #endif // EntryDlg_H diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 36851b0..8aed10d 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp @@ -127,21 +127,23 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap m_output = new QMultiLineEdit( groupBox ); m_output->setReadOnly( true ); groupBoxLayout->addWidget( m_output ); layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); QPixmap pic; pic.convertFromImage( Resource::loadImage( "packagemanager/apply" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); m_btnStart = new QPushButton( pic, tr( "Start" ), this ); + m_btnStart->setMinimumHeight( AppLnk::smallIconSize() ); layout->addWidget( m_btnStart, 3, 0 ); connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); pic.convertFromImage( Resource::loadImage( "SettingsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); m_btnOptions = new QPushButton( pic, tr( "Options" ), this ); + m_btnOptions->setMinimumHeight( AppLnk::smallIconSize() ); layout->addWidget( m_btnOptions, 3, 1 ); connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); // Display packages being acted upon in output widget for( int i = 0; i < m_numCommands; i++ ) { if ( !m_packages[ i ].isEmpty() ) { @@ -216,17 +218,17 @@ void InstallDlg::slotBtnStart() if ( btnText == tr( "Abort" ) ) { // Prevent unexecuted commands from executing m_currCommand = 999; // Allow user to close dialog m_btnStart->setText( tr( "Close" ) ); QPixmap pic; - pic.convertFromImage( Resource::loadImage( "enter" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); m_btnStart->setIconSet( pic ); return; } else if ( btnText == tr( "Close" ) ) { // TODO - force reload of package data emit closeInstallDlg(); return; @@ -240,17 +242,17 @@ void InstallDlg::slotBtnStart() m_destination->setEnabled( false ); } m_btnOptions->setEnabled( false ); if ( m_numCommands > 1 ) { m_btnStart->setText( tr( "Abort" ) ); QPixmap pic; - pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + pic.convertFromImage( Resource::loadImage( "reset" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); m_btnStart->setIconSet( pic ); } else { m_btnStart->setEnabled( false ); } for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) @@ -259,17 +261,17 @@ void InstallDlg::slotBtnStart() m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, this, SLOT(slotOutput(const QString &)), true ); } // All commands executed, allow user to close dialog m_btnStart->setEnabled( true ); m_btnStart->setText( tr( "Close" ) ); QPixmap pic; - pic.convertFromImage( Resource::loadImage( "enter" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); m_btnStart->setIconSet( pic ); m_btnOptions->setEnabled( true ); m_btnOptions->setText( tr( "Save output" ) ); pic.convertFromImage( Resource::loadImage( "save" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); m_btnOptions->setIconSet( pic ); } diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 5f60990..d234251 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp @@ -178,29 +178,32 @@ void OIpkgConfigDlg::initServerWidget() QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) ); m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 ); QPixmap pic; pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); + btn->setMinimumHeight( AppLnk::smallIconSize() ); QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); layout->addWidget( btn, 1, 0 ); pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); m_serverEditBtn = new QPushButton( pic, tr( "Edit" ), container ); + m_serverEditBtn->setMinimumHeight( AppLnk::smallIconSize() ); m_serverEditBtn->setEnabled( false ); QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) ); connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) ); layout->addWidget( m_serverEditBtn, 1, 1 ); pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); m_serverDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); + m_serverDeleteBtn->setMinimumHeight( AppLnk::smallIconSize() ); m_serverDeleteBtn->setEnabled( false ); QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); layout->addWidget( m_serverDeleteBtn, 1, 2 ); } void OIpkgConfigDlg::initDestinationWidget() { @@ -220,29 +223,32 @@ void OIpkgConfigDlg::initDestinationWidget() QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) ); m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) ); layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 ); QPixmap pic; pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); + btn->setMinimumHeight( AppLnk::smallIconSize() ); QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); layout->addWidget( btn, 1, 0 ); pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); m_destEditBtn = new QPushButton( pic, tr( "Edit" ), container ); + m_destEditBtn->setMinimumHeight( AppLnk::smallIconSize() ); m_destEditBtn->setEnabled( false ); QWhatsThis::add( m_destEditBtn, tr( "Tap here to edit the entry selected above." ) ); connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) ); layout->addWidget( m_destEditBtn, 1, 1 ); pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); m_destDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); + m_destDeleteBtn->setMinimumHeight( AppLnk::smallIconSize() ); m_destDeleteBtn->setEnabled( false ); QWhatsThis::add( m_destDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); layout->addWidget( m_destDeleteBtn, 1, 2 ); } void OIpkgConfigDlg::initProxyWidget() { @@ -649,17 +655,19 @@ OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) layout->addWidget( label ); QHBoxLayout *layout2 = new QHBoxLayout( this, 2, 4 ); layout->addLayout( layout2 ); m_location = new QLineEdit( this ); QWhatsThis::add( m_location, tr( "Enter the absolute directory path of this entry here." ) ); layout2->addWidget( m_location ); - QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, this ); + QPixmap pic; + pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); + QPushButton *btn = new QPushButton( pic, QString::null, this ); btn->setMaximumWidth( btn->height() ); QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) ); connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) ); layout2->addWidget( btn ); // Populate initial information if ( m_dest ) { |