author | drw <drw> | 2003-04-22 02:08:38 (UTC) |
---|---|---|
committer | drw <drw> | 2003-04-22 02:08:38 (UTC) |
commit | f37fda5887250b25033120021aed2f1e48f48b1b (patch) (side-by-side diff) | |
tree | fa97b82d00209bc72d120d15792d107cfb03736b /noncore/settings | |
parent | 2d4cf8a85edc83b72855854b0bd337d2993df95b (diff) | |
download | opie-f37fda5887250b25033120021aed2f1e48f48b1b.zip opie-f37fda5887250b25033120021aed2f1e48f48b1b.tar.gz opie-f37fda5887250b25033120021aed2f1e48f48b1b.tar.bz2 |
Now display package information in separate window...easier for those long descriptions. Also use click and hold to display info, not double-click.
-rw-r--r-- | noncore/settings/aqpkg/aqpkg.pro | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 50 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/packagewin.cpp | 119 | ||||
-rw-r--r-- | noncore/settings/aqpkg/packagewin.h | 45 |
5 files changed, 180 insertions, 38 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro index 5b5d506..d241d1b 100644 --- a/noncore/settings/aqpkg/aqpkg.pro +++ b/noncore/settings/aqpkg/aqpkg.pro @@ -7,2 +7,3 @@ HEADERS = global.h \ ipkg.h \ + packagewin.h \ package.h \ @@ -22,2 +23,3 @@ SOURCES = mainwin.cpp \ main.cpp \ + packagewin.cpp \ package.cpp \ diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index fb40d52..1aec6a8 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp @@ -50,2 +50,3 @@ #include "mainwin.h" +#include "packagewin.h" #include "settingsimpl.h" @@ -232,3 +233,3 @@ void MainWindow :: initMainWidget() serversList = new QComboBox( networkPkgWindow ); - connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) ); + connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); @@ -241,2 +242,5 @@ void MainWindow :: initMainWidget() QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); + QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold ); + connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), + this, SLOT(slotDisplayPackage(QListViewItem *)) ); @@ -673,16 +677,2 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) } - - QString destName = ""; - if ( package->getLocalPackage() ) - { - if ( package->getLocalPackage()->getInstalledTo() ) - destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); - } - else - { - if ( package->getInstalledTo() ) - destName = package->getInstalledTo()->getDestinationName(); - } - if ( destName != "" ) - new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) ); } @@ -693,25 +683,2 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) - if ( !package->isPackageStoredLocally() ) - { - new QCheckListItem( item, QString( tr( "Description - %1" ).arg( package->getDescription() ) ) ); - new QCheckListItem( item, QString( tr( "Size - %1" ).arg( package->getPackageSize() ) ) ); - new QCheckListItem( item, QString( tr( "Section - %1" ).arg( package->getSection() ) ) ); - } - else - new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( package->getFilename() ) ) ); - - if ( serverName == LOCAL_SERVER ) - { - new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getVersion() ) ) ); - } - else - { - new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( package->getVersion() ) ) ); - if ( package->getLocalPackage() ) - { - if ( package->isInstalled() ) - new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getInstalledVersion() ) ) ); - } - } - packagesList->insertItem( item ); @@ -1184 +1151,8 @@ void MainWindow :: letterPushed( QString t ) } + +void MainWindow :: slotDisplayPackage( QListViewItem *item ) +{ + QString itemstr( ((QCheckListItem*)item)->text() ); + PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) ); + p->showMaximized(); +} diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index 4b044de..0295519 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h @@ -33,2 +33,3 @@ class QLineEdit; class QListView; +class QListViewItem; class QToolBar; @@ -137,2 +138,3 @@ private slots: void letterPushed( QString t ); + void slotDisplayPackage( QListViewItem * ); }; diff --git a/noncore/settings/aqpkg/packagewin.cpp b/noncore/settings/aqpkg/packagewin.cpp new file mode 100644 index 0000000..f00453e --- a/dev/null +++ b/noncore/settings/aqpkg/packagewin.cpp @@ -0,0 +1,119 @@ +/* + This file is part of the OPIE Project + =. + .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> + .>+-= + _;:, .> :=|. 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 "packagewin.h" +#include "package.h" +#include "datamgr.h" + +#include <qpe/resource.h> + +#include <qlabel.h> +#include <qlayout.h> +#include <qpushbutton.h> +#include <qstring.h> + +PackageWindow::PackageWindow( Package *package, const QString &server ) + : QWidget( 0, 0, 0 ) +{ + QVBoxLayout *layout = new QVBoxLayout( this, 4, 4 ); + QString str; + if ( package ) + { + setCaption( package->getPackageName() ); + QString destName; + if ( package->getLocalPackage() ) + { + if ( package->getLocalPackage()->getInstalledTo() ) + destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); + } + else + { + if ( package->getInstalledTo() ) + destName = package->getInstalledTo()->getDestinationName(); + } + + if ( !package->isPackageStoredLocally() ) + { + str.append( tr( "<b>Description</b> - " ) ); + str.append( package->getDescription() ); + if ( !destName.isNull() ) + { + str.append( tr( "<p><b>Installed To</b> - " ) ); + str.append( destName ); + } + str.append( tr( "<p><b>Size</b> - " ) ); + str.append( package->getPackageSize() ); + str.append( tr( "<p><b>Section</b> - " ) ); + str.append( package->getSection() ); + } + else + { + str.append( tr( "<p><b>Filename</b> - " ) ); + str.append( package->getFilename() ); + } + + if ( server == LOCAL_SERVER ) + { + str.append( tr( "<p><b>Version Installed</b> - " ) ); + str.append( package->getVersion() ); + } + else + { + str.append( tr( "<p><b>Version Available</b> - " ) ); + str.append( package->getVersion() ); + if ( package->getLocalPackage() ) + { + if ( package->isInstalled() ) + { + str.append( tr( "<p><b>Version Installed</b> - " ) ); + str.append( package->getInstalledVersion() ); + } + } + } + } + else + { + setCaption( tr( "Package Information" ) ); + str = tr( "Package information is unavailable" ); + } + + QLabel *l = new QLabel( str, this ); + l->setTextFormat( Qt::RichText ); + l->setAlignment( Qt::AlignLeft | Qt::AlignVCenter | Qt::WordBreak ); + layout->addWidget( l ); + + QPushButton *btn = new QPushButton( Resource::loadPixmap( "enter" ), tr( "Close" ), this ); + layout->addWidget( btn ); + connect( btn, SIGNAL( clicked() ), this, SLOT( close() ) ); + +} + +PackageWindow::~PackageWindow() +{ +} + diff --git a/noncore/settings/aqpkg/packagewin.h b/noncore/settings/aqpkg/packagewin.h new file mode 100644 index 0000000..c1943b5 --- a/dev/null +++ b/noncore/settings/aqpkg/packagewin.h @@ -0,0 +1,45 @@ +/* + This file is part of the OPIE Project + =. + .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> + .>+-= + _;:, .> :=|. 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 PACKAGEWIN_H +#define PACKAGEWIN_H + +#include <qwidget.h> + +class Package; + +class PackageWindow :public QWidget +{ + Q_OBJECT +public: + + PackageWindow( Package * = 0x0, const QString & = QString::null ); + ~PackageWindow(); +}; + +#endif
\ No newline at end of file |