summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp166
-rw-r--r--noncore/settings/aqpkg/mainwin.h26
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp52
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h3
4 files changed, 125 insertions, 122 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 4aa83b5..e184f6b 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -24,8 +24,10 @@ using namespace std;
24 24
25#include <qaction.h> 25#include <qaction.h>
26#include <qlineedit.h>
26#include <qmenubar.h> 27#include <qmenubar.h>
27#include <qmessagebox.h> 28#include <qmessagebox.h>
28#include <qpopupmenu.h> 29#include <qpopupmenu.h>
29#include <qtimer.h> 30#include <qtimer.h>
31#include <qwhatsthis.h>
30#include <qwidgetstack.h> 32#include <qwidgetstack.h>
31 33
@@ -57,4 +59,13 @@ MainWindow :: MainWindow()
57 bar = new QPEToolBar( this ); 59 bar = new QPEToolBar( this );
58 60
61 // Find toolbar
62 findBar = new QPEToolBar( this );
63 addToolBar( findBar, QMainWindow::Top, true );
64 findBar->setHorizontalStretchable( true );
65 findEdit = new QLineEdit( findBar );
66 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) );
67 findBar->setStretchableWidget( findEdit );
68 connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) );
69
59 // Packages menu 70 // Packages menu
60 QPopupMenu *popup = new QPopupMenu( this ); 71 QPopupMenu *popup = new QPopupMenu( this );
@@ -92,12 +103,14 @@ MainWindow :: MainWindow()
92 103
93 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 104 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
94 a->setWhatsThis( tr( "Click here to search for a specific package." ) ); 105 a->setWhatsThis( tr( "Click here to search for text in package names." ) );
95 connect( a, SIGNAL( activated() ), this, SLOT( searchForPackage() ) ); 106 connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) );
96 a->addTo( popup ); 107 a->addTo( popup );
97 108
98 a = new QAction( tr( "Find next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); 109 actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 );
99 a->setWhatsThis( tr( "Click here to search for the next package." ) ); 110 actionFindNext->setEnabled( FALSE );
100 connect( a, SIGNAL( activated() ), this, SLOT( repeatSearchForPackage() ) ); 111 actionFindNext->setWhatsThis( tr( "Click here to search for the package name containing the text you are searching for." ) );
101 a->addTo( popup ); 112 connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) );
113 actionFindNext->addTo( popup );
114 actionFindNext->addTo( findBar );
102 115
103 // Show 'quick jump' keypad? 116 // Show 'quick jump' keypad?
@@ -105,8 +118,9 @@ MainWindow :: MainWindow()
105 popup->insertSeparator(); 118 popup->insertSeparator();
106 119
107 a = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); 120 actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 );
108 a->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); 121 actionFilter->setToggleAction( TRUE );
109 connect( a, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); 122 actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) );
110 a->addTo( popup ); 123 connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) );
124 actionFilter->addTo( popup );
111 125
112 a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); 126 a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 );
@@ -121,18 +135,21 @@ MainWindow :: MainWindow()
121 popup = new QPopupMenu( this ); 135 popup = new QPopupMenu( this );
122 136
123 a = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); 137 actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
124 a->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); 138 actionUninstalled->setToggleAction( TRUE );
125 connect( a, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); 139 actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) );
126 a->addTo( popup ); 140 connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) );
141 actionUninstalled->addTo( popup );
127 142
128 a = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); 143 actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
129 a->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); 144 actionInstalled->setToggleAction( TRUE );
130 connect( a, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); 145 actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) );
131 a->addTo( popup ); 146 connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) );
147 actionInstalled->addTo( popup );
132 148
133 a = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); 149 actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
134 a->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); 150 actionUpdated->setToggleAction( TRUE );
135 connect( a, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); 151 actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) );
136 a->addTo( popup ); 152 connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) );
153 actionUpdated->addTo( popup );
137 154
138 popup->insertSeparator(); 155 popup->insertSeparator();
@@ -156,5 +173,13 @@ MainWindow :: MainWindow()
156 173
157 mb->insertItem( tr( "View" ), popup ); 174 mb->insertItem( tr( "View" ), popup );
175
176 // Finish find toolbar creation
177 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
178 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) );
179 connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) );
180 a->addTo( findBar );
181 findBar->hide();
158 182
183
159 // Create widget stack and add UI widgets 184 // Create widget stack and add UI widgets
160 stack = new QWidgetStack( this ); 185 stack = new QWidgetStack( this );
@@ -220,13 +245,25 @@ void MainWindow :: displayHelp()
220 delete dlg; 245 delete dlg;
221} 246}
247
248void MainWindow :: displayFindBar()
249{
250 findBar->show();
251 findEdit->setFocus();
252}
222 253
223void MainWindow :: searchForPackage() 254void MainWindow :: repeatFind()
224{ 255{
225 networkPkgWindow->searchForPackage( false ); 256 networkPkgWindow->searchForPackage( findEdit->text() );
226} 257}
227 258
228void MainWindow :: repeatSearchForPackage() 259void MainWindow :: findPackage( const QString &text )
229{ 260{
230 networkPkgWindow->searchForPackage( true ); 261 actionFindNext->setEnabled( !text.isEmpty() );
262 networkPkgWindow->searchForPackage( text );
263}
264
265void MainWindow :: hideFindBar()
266{
267 findBar->hide();
231} 268}
232 269
@@ -236,89 +273,40 @@ void MainWindow :: displayAbout()
236} 273}
237 274
238
239void MainWindow :: filterUninstalledPackages() 275void MainWindow :: filterUninstalledPackages()
240{ 276{
241 bool val; 277 networkPkgWindow->showOnlyUninstalledPackages( actionUninstalled->isOn() );
242 if ( filter->isItemChecked( mnuShowUninstalledPkgsId ) ) 278 actionInstalled->setOn( FALSE );
243 { 279 actionUpdated->setOn( FALSE );
244 val = false;
245 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
246 }
247 else
248 {
249 val = true;
250 filter->setItemChecked( mnuShowUninstalledPkgsId, true );
251 }
252
253 filter->setItemChecked( mnuShowInstalledPkgsId, false );
254 networkPkgWindow->showOnlyInstalledPackages( false );
255 filter->setItemChecked( mnuShowUpgradedPkgsId, false );
256 networkPkgWindow->showUpgradedPackages( false );
257
258 networkPkgWindow->showOnlyUninstalledPackages( val );
259
260} 280}
261 281
262void MainWindow :: filterInstalledPackages() 282void MainWindow :: filterInstalledPackages()
263{ 283{
264 bool val; 284 actionUninstalled->setOn( FALSE );
265 if ( filter->isItemChecked( mnuShowInstalledPkgsId ) ) 285 networkPkgWindow->showOnlyInstalledPackages( actionInstalled->isOn() );
266 { 286 actionUpdated->setOn( FALSE );
267 val = false;
268 filter->setItemChecked( mnuShowInstalledPkgsId, false );
269 }
270 else
271 {
272 val = true;
273 filter->setItemChecked( mnuShowInstalledPkgsId, true );
274 }
275
276 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
277 networkPkgWindow->showOnlyUninstalledPackages( false );
278 filter->setItemChecked( mnuShowUpgradedPkgsId, false );
279 networkPkgWindow->showUpgradedPackages( false );
280
281 networkPkgWindow->showOnlyInstalledPackages( val );
282} 287}
283 288
284void MainWindow :: filterUpgradedPackages() 289void MainWindow :: filterUpgradedPackages()
285{ 290{
286 bool val; 291 actionUninstalled->setOn( FALSE );
287 if ( filter->isItemChecked( mnuShowUpgradedPkgsId ) ) 292 actionInstalled->setOn( FALSE );
288 { 293 networkPkgWindow->showUpgradedPackages( actionUpdated->isOn() );
289 val = false;
290 filter->setItemChecked( mnuShowUpgradedPkgsId, false );
291 }
292 else
293 {
294 val = true;
295 filter->setItemChecked( mnuShowUpgradedPkgsId, true );
296 }
297
298 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
299 networkPkgWindow->showOnlyUninstalledPackages( false );
300 filter->setItemChecked( mnuShowInstalledPkgsId, false );
301 networkPkgWindow->showOnlyInstalledPackages( false );
302
303 networkPkgWindow->showUpgradedPackages( val );
304} 294}
305 295
306void MainWindow :: setFilterCategory() 296void MainWindow :: setFilterCategory()
307{ 297{
308 if ( networkPkgWindow->setFilterCategory( ) ) 298 if ( networkPkgWindow->setFilterCategory() )
309 filter->setItemChecked( mnuFilterByCategory, true ); 299 actionFilter->setOn( TRUE );
310} 300}
311 301
312void MainWindow :: filterCategory() 302void MainWindow :: filterCategory()
313{ 303{
314 if ( filter->isItemChecked( mnuFilterByCategory ) ) 304 if ( !actionFilter->isOn() )
315 { 305 {
316 networkPkgWindow->filterByCategory( false ); 306 networkPkgWindow->filterByCategory( FALSE );
317 filter->setItemChecked( mnuFilterByCategory, false );
318 } 307 }
319 else 308 else
320 { 309 {
321 if ( networkPkgWindow->filterByCategory( true ) ) 310 actionFilter->setOn( networkPkgWindow->filterByCategory( TRUE ) );
322 filter->setItemChecked( mnuFilterByCategory, true );
323 } 311 }
324} 312}
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index 028ef5b..ef67cc9 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -21,8 +21,8 @@
21#include <qmainwindow.h> 21#include <qmainwindow.h>
22#include <qpixmap.h> 22#include <qpixmap.h>
23//#include <qwidgetstack.h>
24 23
25class QWidgetStack; 24class QWidgetStack;
26class QPEToolBar; 25class QPEToolBar;
26class QLineEdit;
27class QAction; 27class QAction;
28class ProgressWidget; 28class ProgressWidget;
@@ -41,12 +41,16 @@ private:
41 DataManager *mgr; 41 DataManager *mgr;
42 42
43 QMenuBar *menu;
44 QPopupMenu *help;
45 QPopupMenu *settings;
46 QPopupMenu *edit;
47 QPopupMenu *filter;
48 QWidgetStack *stack; 43 QWidgetStack *stack;
49 QAction *actionUpgrade; 44
50 QAction *actionDownload; 45 QPEToolBar *findBar;
46 QLineEdit *findEdit;
47 QAction *actionFindNext;
48 QAction *actionFilter;
49 QAction *actionUpgrade;
50 QAction *actionDownload;
51 QAction *actionUninstalled;
52 QAction *actionInstalled;
53 QAction *actionUpdated;
54
51 QPixmap iconDownload; 55 QPixmap iconDownload;
52 QPixmap iconRemove; 56 QPixmap iconRemove;
@@ -64,6 +68,8 @@ public slots:
64 void setDocument( const QString &doc ); 68 void setDocument( const QString &doc );
65 void displayHelp(); 69 void displayHelp();
66 void searchForPackage(); 70 void displayFindBar();
67 void repeatSearchForPackage(); 71 void repeatFind();
72 void findPackage( const QString & );
73 void hideFindBar();
68 void displayAbout(); 74 void displayAbout();
69 void displaySettings(); 75 void displaySettings();
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 91afe02..c209589 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -261,8 +261,8 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress )
261 261
262 262
263 text += it->getPackageName(); 263 text.append( it->getPackageName() );
264 if ( it->isInstalled() ) 264 if ( it->isInstalled() )
265 { 265 {
266 text += " (installed)"; 266 text.append( " (installed)" );
267 267
268 // If a different version of package is available, postfix it with an * 268 // If a different version of package is available, postfix it with an *
@@ -271,5 +271,5 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress )
271 271
272 if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 ) 272 if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 )
273 text += "*"; 273 text.append( "*" );
274 } 274 }
275 } 275 }
@@ -291,27 +291,27 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress )
291 } 291 }
292 if ( destName != "" ) 292 if ( destName != "" )
293 new QCheckListItem( item, QString( tr( "Installed To - " ) ) + destName ); 293 new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) );
294 } 294 }
295 295
296 if ( !it->isPackageStoredLocally() ) 296 if ( !it->isPackageStoredLocally() )
297 { 297 {
298 new QCheckListItem( item, QString( tr( "Description - " ) ) + it->getDescription() ); 298 new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) );
299 new QCheckListItem( item, QString( tr( "Size - " ) ) + it->getPackageSize() ); 299 new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) );
300 new QCheckListItem( item, QString( tr( "Section - " ) ) + it->getSection() ); 300 new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) );
301 } 301 }
302 else 302 else
303 new QCheckListItem( item, QString( tr( "Filename - " ) ) + it->getFilename() ); 303 new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) );
304 304
305 if ( serverName == LOCAL_SERVER ) 305 if ( serverName == LOCAL_SERVER )
306 { 306 {
307 new QCheckListItem( item, QString( tr( "V. Installed - " ) ) + it->getVersion() ); 307 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) );
308 } 308 }
309 else 309 else
310 { 310 {
311 new QCheckListItem( item, QString( tr( "V. Available - " ) ) + it->getVersion() ); 311 new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) );
312 if ( it->getLocalPackage() ) 312 if ( it->getLocalPackage() )
313 { 313 {
314 if ( it->isInstalled() ) 314 if ( it->isInstalled() )
315 new QCheckListItem( item, QString( tr( "V. Installed - " ) ) + it->getInstalledVersion() ); 315 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getInstalledVersion() ) ) );
316 } 316 }
317 } 317 }
@@ -373,4 +373,5 @@ void NetworkPackageManager :: upgradePackages()
373 // We're gonna do an upgrade of all packages 373 // We're gonna do an upgrade of all packages
374 // First warn user that this isn't recommended 374 // First warn user that this isn't recommended
375 // TODO - ODevice????
375 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); 376 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" );
376 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, 377 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning,
@@ -774,15 +775,9 @@ void NetworkPackageManager :: letterPushed( QString t )
774 775
775 776
776void NetworkPackageManager :: searchForPackage( bool findNext ) 777void NetworkPackageManager :: searchForPackage( const QString &text )
777{ 778{
778 bool ok = false; 779 if ( !text.isEmpty() )
779 if ( !findNext || lastSearchText.isEmpty() )
780 lastSearchText = InputDialog::getText( tr( "Search for package" ), tr( "Enter package to search for" ), lastSearchText, &ok, this ).lower();
781 else
782 ok = true;
783
784 if ( ok && !lastSearchText.isEmpty() )
785 { 780 {
786 cout << "searching for " << lastSearchText << endl; 781 cout << "searching for " << text << endl;
787 // look through package list for text startng at current position 782 // look through package list for text startng at current position
788 vector<InstallData> workingPackages; 783 vector<InstallData> workingPackages;
@@ -798,5 +793,5 @@ void NetworkPackageManager :: searchForPackage( bool findNext )
798 { 793 {
799 cout << "checking " << item->text().lower() << endl; 794 cout << "checking " << item->text().lower() << endl;
800 if ( item->text().lower().find( lastSearchText ) != -1 ) 795 if ( item->text().lower().find( text ) != -1 )
801 { 796 {
802 cout << "matched " << item->text() << endl; 797 cout << "matched " << item->text() << endl;
@@ -812,4 +807,9 @@ void NetworkPackageManager :: showOnlyUninstalledPackages( bool val )
812{ 807{
813 showUninstalledPkgs = val; 808 showUninstalledPkgs = val;
809 if ( val )
810 {
811 showInstalledPkgs = FALSE;
812 showUpgradedPkgs = FALSE;
813 }
814 serverSelected( -1 ); 814 serverSelected( -1 );
815} 815}
@@ -818,4 +818,9 @@ void NetworkPackageManager :: showOnlyInstalledPackages( bool val )
818{ 818{
819 showInstalledPkgs = val; 819 showInstalledPkgs = val;
820 if ( val )
821 {
822 showUninstalledPkgs = FALSE;
823 showUpgradedPkgs = FALSE;
824 }
820 serverSelected( -1 ); 825 serverSelected( -1 );
821} 826}
@@ -824,4 +829,9 @@ void NetworkPackageManager :: showUpgradedPackages( bool val )
824{ 829{
825 showUpgradedPkgs = val; 830 showUpgradedPkgs = val;
831 if ( val )
832 {
833 showUninstalledPkgs = FALSE;
834 showInstalledPkgs = FALSE;
835 }
826 serverSelected( -1 ); 836 serverSelected( -1 );
827} 837}
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h
index efef898..bd005e2 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.h
+++ b/noncore/settings/aqpkg/networkpkgmgr.h
@@ -42,5 +42,5 @@ public:
42 void selectLocalPackage( const QString &pkg ); 42 void selectLocalPackage( const QString &pkg );
43 void updateData(); 43 void updateData();
44 void searchForPackage( bool findNext ); 44 void searchForPackage( const QString & );
45 void showOnlyUninstalledPackages( bool val ); 45 void showOnlyUninstalledPackages( bool val );
46 void showOnlyInstalledPackages( bool val ); 46 void showOnlyInstalledPackages( bool val );
@@ -56,5 +56,4 @@ private:
56 56
57 QString currentlySelectedServer; 57 QString currentlySelectedServer;
58 QString lastSearchText;
59 QString categoryFilter; 58 QString categoryFilter;
60 59