summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/ChangeLog21
-rw-r--r--noncore/settings/packagemanager/entrydlg.cpp5
-rw-r--r--noncore/settings/packagemanager/filterdlg.cpp2
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp2
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.cpp2
-rw-r--r--noncore/settings/packagemanager/opackagemanager.cpp2
-rw-r--r--noncore/settings/packagemanager/promptdlg.cpp4
-rw-r--r--noncore/settings/packagemanager/promptdlg.h2
8 files changed, 22 insertions, 18 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog
index 72e6169..744122f 100644
--- a/noncore/settings/packagemanager/ChangeLog
+++ b/noncore/settings/packagemanager/ChangeLog
@@ -1,20 +1,21 @@
-2004-mm-dd Dan Williams <drw@handhelds.org>
+2004-02-12 Dan Williams <drw@handhelds.org>
- * Package information dialog implemented
- * What's This app icon enabled
+ * Package information dialog implemented
+ * What's This app icon enabled
+ * Changed all QDialog::exec() occurences to QPEApplication::execDialog()
2004-01-23 Dan Williams <drw@handhelds.org>
- * Added package download functionality
- * Have Opie update links after install/removal so that apps
- will display properly in Launcher
+ * Added package download functionality
+ * Have Opie update links after install/removal so that apps
+ will display properly in Launcher
2004-01-20 Dan Williams <drw@handhelds.org>
- * Released version 0.2.0
- * Converted to use libipkg in place of spawning ipkg process
+ * Released version 0.2.0
+ * Converted to use libipkg in place of spawning ipkg process
2004-01-13 Dan Williams <drw@handhelds.org>
- * Released version 0.1.0
- * Initial check-in of new package management client to eventually replace AQPkg
+ * Released version 0.1.0
+ * Initial check-in of new package management client to eventually replace AQPkg
diff --git a/noncore/settings/packagemanager/entrydlg.cpp b/noncore/settings/packagemanager/entrydlg.cpp
index 8deaa37..663abd2 100644
--- a/noncore/settings/packagemanager/entrydlg.cpp
+++ b/noncore/settings/packagemanager/entrydlg.cpp
@@ -1,82 +1,85 @@
/*
                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.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "entrydlg.h"
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qpushbutton.h>
+#include <qpe/qpeapplication.h>
+
EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal )
: QDialog( parent, name, modal )
{
QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 );
QLabel *l = new QLabel( label, this );
l->setAlignment( AlignLeft | AlignTop | WordBreak );
vbox->addWidget( l );
m_entry = new QLineEdit( this );
vbox->addWidget( m_entry );
connect( m_entry, SIGNAL(returnPressed()), this, SLOT(tryAccept()) );
}
void EntryDlg::setText( const QString &text )
{
m_entry->setText( text );
m_entry->selectAll();
}
QString EntryDlg::getText()
{
return m_entry->text();
}
QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok,
QWidget *parent, const char *name )
{
EntryDlg *dlg = new EntryDlg( label, parent, name, true );
dlg->setCaption( caption );
dlg->setText( text );
QString result;
- *ok = ( dlg->exec() == QDialog::Accepted );
+
+ *ok = ( QPEApplication::execDialog( dlg ) == QDialog::Accepted );
if ( *ok )
result = dlg->getText();
delete dlg;
return result;
}
void EntryDlg::tryAccept()
{
if ( !m_entry->text().isEmpty() )
accept();
}
diff --git a/noncore/settings/packagemanager/filterdlg.cpp b/noncore/settings/packagemanager/filterdlg.cpp
index 2e48d5b..0da9d19 100644
--- a/noncore/settings/packagemanager/filterdlg.cpp
+++ b/noncore/settings/packagemanager/filterdlg.cpp
@@ -63,97 +63,97 @@ FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name,
m_name->setEnabled( !name.isNull() );
layout->addWidget( m_nameCB );
layout->addWidget( m_name );
// Status
m_statusCB = new QCheckBox( tr( "With the status:" ), container );
connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) );
m_status = new QComboBox( container );
connect( m_status, SIGNAL(activated(const QString &)), this, SLOT(slotStatusChanged(const QString &)) );
QString currStatus;
switch ( status )
{
case OPackageManager::All : currStatus = tr( "All" );
break;
case OPackageManager::Installed : currStatus = tr( "Installed" );
break;
case OPackageManager::NotInstalled : currStatus = tr( "Not installed" );
break;
case OPackageManager::Updated : currStatus = tr( "Updated" );
break;
default : currStatus = QString::null;
};
m_status->insertItem( tr( "All" ) );
m_status->insertItem( tr( "Installed" ) );
m_status->insertItem( tr( "Not installed" ) );
m_status->insertItem( tr( "Updated" ) );
initItem( m_status, m_statusCB, currStatus );
layout->addWidget( m_statusCB );
layout->addWidget( m_status );
// Server
m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container );
connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) );
m_server = new QComboBox( container );
m_server->insertStringList( *(pm->servers()) );
initItem( m_server, m_serverCB, server );
layout->addWidget( m_serverCB );
layout->addWidget( m_server );
// Destination
m_destCB = new QCheckBox( tr( "Installed on device at:" ), container );
connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) );
m_destination = new QComboBox( container );
m_destination->insertStringList( *(pm->destinations()) );
initItem( m_destination, m_destCB, destination );
layout->addWidget( m_destCB );
layout->addWidget( m_destination );
- showMaximized();
+ //showMaximized();
}
void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection )
{
if ( !selection.isNull() )
{
checkBox->setChecked( true );
for ( int i = 0; i < comboBox->count(); i++ )
{
if ( comboBox->text( i ) == selection )
{
comboBox->setCurrentItem( i );
return;
}
}
}
comboBox->setEnabled( !selection.isNull() );
}
void FilterDlg::slotNameSelected( bool selected )
{
m_name->setEnabled( selected );
}
void FilterDlg::slotServerSelected( bool selected )
{
m_server->setEnabled( selected );
}
void FilterDlg::slotDestSelected( bool selected )
{
m_destination->setEnabled( selected );
}
void FilterDlg::slotStatusSelected( bool selected )
{
m_status->setEnabled( selected );
if ( !selected && !m_destCB->isEnabled() )
{
// If status check box has been deselected and destination option was previously deselected
// (because status == "Not installed"), re-enable destination option
m_destCB->setEnabled( true );
m_destination->setEnabled( true );
}
else if ( selected && m_destCB->isEnabled() && m_status->currentText() == tr( "Not installed" ) )
{
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 8b374ab..2cb11ba 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -566,97 +566,97 @@ void MainWindow::slotShowNotInstalled()
delete packageList;
}
}
void MainWindow::slotShowInstalled()
{
OPackageList *packageList;
if ( m_actionShowInstalled->isOn() )
{
m_actionShowNotInstalled->setOn( false );
m_actionShowUpdated->setOn( false );
packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
OPackageManager::Installed, QString::null );
}
else
packageList = m_packman.packages();
if ( packageList )
{
loadPackageList( packageList, true );
delete packageList;
}
}
void MainWindow::slotShowUpdated()
{
OPackageList *packageList;
if ( m_actionShowUpdated->isOn() )
{
m_actionShowInstalled->setOn( false );
m_actionShowNotInstalled->setOn( false );
packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
OPackageManager::Updated, QString::null );
}
else
packageList = m_packman.packages();
if ( packageList )
{
loadPackageList( packageList, true );
delete packageList;
}
}
void MainWindow::slotFilterChange()
{
FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus,
m_filterCategory );
- if ( dlg.exec() == QDialog::Accepted )
+ if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
{
m_filterName = dlg.name();
m_filterServer = dlg.server();
m_filterDest = dlg.destination();
m_filterStatus = dlg.status();
m_filterCategory = dlg.category();
m_actionFilter->setOn( true );
slotFilter( true );
}
else
{
m_actionFilter->setOn( false );
slotFilter( false );
}
}
void MainWindow::slotFilter( bool isOn )
{
OPackageList *packageList;
if ( isOn )
{
packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest,
m_filterStatus, m_filterCategory );
}
else
packageList = m_packman.packages();
if ( packageList )
{
loadPackageList( packageList, true );
delete packageList;
}
}
void MainWindow::slotFindShowToolbar()
{
m_findBar.show();
m_findEdit->setFocus();
}
void MainWindow::slotFindHideToolbar()
{
m_findBar.hide();
}
void MainWindow::slotFindChanged( const QString &findText )
{
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
index e335f8f..84c6de4 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
@@ -38,97 +38,97 @@
#include <qlineedit.h>
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qscrollview.h>
#include <qpe/resource.h>
OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent )
: QDialog( parent, QString::null, true )
, m_ipkg( ipkg )
, m_configs( 0x0 )
, m_installOptions( installOptions )
, m_serverNew( false )
, m_serverCurrent( -1 )
, m_destNew( false )
, m_destCurrent( -1 )
, m_layout( this, 2, 4 )
, m_tabWidget( this )
{
setCaption( tr( "Configuration" ) );
// Initialize configuration widgets
if ( !installOptions )
{
initServerWidget();
initDestinationWidget();
initProxyWidget();
}
initOptionsWidget();
// Load configuration information
initData();
// Setup tabs for all info
m_layout.addWidget( &m_tabWidget );
if ( !m_installOptions )
{
m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) );
m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) );
m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) );
m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) );
m_tabWidget.setCurrentTab( tr( "Servers" ) );
}
else
{
m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) );
}
- showMaximized();
+ //showMaximized();
}
void OIpkgConfigDlg::accept()
{
// Save server, destination and proxy configuration
if ( !m_installOptions )
m_ipkg->setConfigItems( m_configs );
// Save options configuration
int options = 0;
if ( m_optForceDepends->isChecked() )
options |= FORCE_DEPENDS;
if ( m_optForceReinstall->isChecked() )
options |= FORCE_REINSTALL;
if ( m_optForceRemove->isChecked() )
options |= FORCE_REMOVE;
if ( m_optForceOverwrite->isChecked() )
options |= FORCE_OVERWRITE;
m_ipkg->setIpkgExecOptions( options );
m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() );
QDialog::accept();
}
void OIpkgConfigDlg::reject()
{
if ( m_configs )
delete m_configs;
}
void OIpkgConfigDlg::initServerWidget()
{
m_serverWidget = new QWidget( this );
// Initialize UI
QVBoxLayout *vb = new QVBoxLayout( m_serverWidget );
QScrollView *sv = new QScrollView( m_serverWidget );
vb->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 );
m_serverList = new QListBox( container );
m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerEdit(int)) );
layout->addMultiCellWidget( m_serverList, 0, 0, 0, 1 );
diff --git a/noncore/settings/packagemanager/opackagemanager.cpp b/noncore/settings/packagemanager/opackagemanager.cpp
index e1c8a21..ad2fe02 100644
--- a/noncore/settings/packagemanager/opackagemanager.cpp
+++ b/noncore/settings/packagemanager/opackagemanager.cpp
@@ -262,62 +262,62 @@ QStringList *OPackageManager::destinations()
}
}
return dl;
}
OConfItem *OPackageManager::findConfItem( OConfItem::Type type, const QString &name )
{
OConfItem *confItem = 0x0;
OConfItemList *confList = m_ipkg.configItems();
if ( confList )
{
for ( OConfItemListIterator confIt( *confList ); confIt.current(); ++confIt )
{
OConfItem *conf = confIt.current();
// Add only active confinations
if ( conf->type() == type && conf->name() == name )
{
confItem = conf;
break;
}
}
}
return confItem;
}
OPackage *OPackageManager::findPackage( const QString &name )
{
return m_packages[ name ];
}
int OPackageManager::compareVersions( const QString &version1, const QString &version2 )
{
// TODO - do proper compare!
if ( version1 < version2 )
return -1;
else if ( version1 > version2 )
return 1;
return 0;
}
bool OPackageManager::configureDlg( bool installOptions )
{
OIpkgConfigDlg dlg( &m_ipkg, installOptions, static_cast<QWidget *>(parent()) );
- return ( dlg.exec() == QDialog::Accepted );
+ return ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
}
void OPackageManager::saveSettings()
{
m_ipkg.saveSettings();
}
bool OPackageManager::executeCommand( OPackage::Command command, QStringList *packages,
const QString &destination, const QObject *receiver,
const char *slotOutput, bool rawOutput )
{
return m_ipkg.executeCommand( command, packages, destination, receiver, slotOutput, rawOutput );
}
diff --git a/noncore/settings/packagemanager/promptdlg.cpp b/noncore/settings/packagemanager/promptdlg.cpp
index bb27190..128e88e 100644
--- a/noncore/settings/packagemanager/promptdlg.cpp
+++ b/noncore/settings/packagemanager/promptdlg.cpp
@@ -12,129 +12,129 @@
     ._= =}       : 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 "promptdlg.h"
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qwidgetlist.h>
#include <qpe/qpeapplication.h>
PromptDlg::PromptDlg( const QString &caption, const QString &text, const QString &btn1, const QString &btn2,
QWidget *parent )
: QWidget( parent, QString::null, WType_Modal | WType_TopLevel | WStyle_Dialog )
, m_btnClicked( -1 )
{
setCaption( caption );
QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 2 );
QLabel *label = new QLabel( text, this );
label->setAlignment( AlignCenter | AlignTop | WordBreak );
layout->addMultiCellWidget( label, 0, 0, 0, 1 );
QPushButton *btn = new QPushButton( btn1, this );
layout->addWidget( btn, 1, 0 );
connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn1Clicked()) );
btn = new QPushButton( btn2, this );
layout->addWidget( btn, 1, 1 );
connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn2Clicked()) );
}
-int PromptDlg::exec()
+int PromptDlg::display()
{
// Determine position of dialog. Derived from QT's QDialog::show() method.
QWidget *w = parentWidget();
QPoint p( 0, 0 );
int extraw = 0, extrah = 0;
QWidget * desk = QApplication::desktop();
if ( w )
w = w->topLevelWidget();
QWidgetList *list = QApplication::topLevelWidgets();
QWidgetListIt it( *list );
while ( (extraw == 0 || extrah == 0) && it.current() != 0 )
{
int w, h;
QWidget * current = it.current();
++it;
w = current->geometry().x() - current->x();
h = current->geometry().y() - current->y();
extraw = QMAX( extraw, w );
extrah = QMAX( extrah, h );
}
delete list;
// sanity check for decoration frames. With embedding, we
// might get extraordinary values
if ( extraw >= 10 || extrah >= 40 )
extraw = extrah = 0;
if ( w )
{
// Use mapToGlobal rather than geometry() in case w might
// be embedded in another application
QPoint pp = w->mapToGlobal( QPoint(0,0) );
p = QPoint( pp.x() + w->width()/2, pp.y() + w->height()/ 2 );
}
else
p = QPoint( desk->width()/2, desk->height()/2 );
p = QPoint( p.x()-width()/2 - extraw, p.y()-height()/2 - extrah );
if ( p.x() + extraw + width() > desk->width() )
p.setX( desk->width() - width() - extraw );
if ( p.x() < 0 )
p.setX( 0 );
if ( p.y() + extrah + height() > desk->height() )
p.setY( desk->height() - height() - extrah );
if ( p.y() < 0 )
p.setY( 0 );
move( p );
show();
// Enter event loop for modality
qApp->enter_loop();
return m_btnClicked;
}
int PromptDlg::ask( const QString &caption, const QString &text, const QString &btn1, const QString &btn2,
QWidget *parent )
{
PromptDlg *dlg = new PromptDlg( caption, text, btn1, btn2, parent );
- int rc = dlg->exec();
+ int rc = dlg->display();
delete dlg;
return rc;
}
void PromptDlg::slotBtn1Clicked()
{
m_btnClicked = 1;
qApp->exit_loop();
}
void PromptDlg::slotBtn2Clicked()
{
m_btnClicked = 2;
qApp->exit_loop();
}
diff --git a/noncore/settings/packagemanager/promptdlg.h b/noncore/settings/packagemanager/promptdlg.h
index e0e9f41..790ff4d 100644
--- a/noncore/settings/packagemanager/promptdlg.h
+++ b/noncore/settings/packagemanager/promptdlg.h
@@ -1,57 +1,57 @@
/*
                This file is part of the OPIE Project
=. Copyright (c) 2003 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.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef PROMPTDLG_H
#define PROMPTDLG_H
#include <qwidget.h>
class PromptDlg : public QWidget
{
Q_OBJECT
public:
PromptDlg( const QString &caption = 0x0, const QString &text = 0x0, const QString &btn1 = 0x0,
const QString &btn2 = 0x0, QWidget *parent = 0x0 );
- int exec();
+ int display();
int btnPressed() { return m_btnClicked; }
static int ask( const QString &caption = 0x0, const QString &text = 0x0, const QString &btn1 = 0x0,
const QString &btn2 = 0x0, QWidget *parent = 0x0 );
private:
int m_btnClicked; // Indicator for which button was pressed
private slots:
void slotBtn1Clicked();
void slotBtn2Clicked();
};
#endif