summaryrefslogtreecommitdiff
authorandyq <andyq>2002-10-18 22:40:08 (UTC)
committer andyq <andyq>2002-10-18 22:40:08 (UTC)
commitf899c1a0d216a1197c947a533d82085a02fed259 (patch) (unidiff)
treed0bf68d5fbf2021acc35973978e063cb6a8a5906
parenteea247f2664f0c70247399b2f4d969ddb00df7ba (diff)
downloadopie-f899c1a0d216a1197c947a533d82085a02fed259.zip
opie-f899c1a0d216a1197c947a533d82085a02fed259.tar.gz
opie-f899c1a0d216a1197c947a533d82085a02fed259.tar.bz2
Added option to settings to show or hide Jump To letters
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp27
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h1
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp23
-rw-r--r--noncore/settings/aqpkg/settingsimpl.h2
4 files changed, 40 insertions, 13 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index ed5bf75..3aee7bd 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -32,48 +32,49 @@ using namespace std;
32#endif 32#endif
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36 36
37#include "datamgr.h" 37#include "datamgr.h"
38#include "networkpkgmgr.h" 38#include "networkpkgmgr.h"
39#include "installdlgimpl.h" 39#include "installdlgimpl.h"
40#include "ipkg.h" 40#include "ipkg.h"
41#include "inputdlg.h" 41#include "inputdlg.h"
42#include "letterpushbutton.h" 42#include "letterpushbutton.h"
43 43
44#include "global.h" 44#include "global.h"
45 45
46NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) 46NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name)
47 : QWidget(parent, name) 47 : QWidget(parent, name)
48{ 48{
49 dataMgr = dataManager; 49 dataMgr = dataManager;
50 50
51#ifdef QWS 51#ifdef QWS
52 // read download directory from config file 52 // read download directory from config file
53 Config cfg( "aqpkg" ); 53 Config cfg( "aqpkg" );
54 cfg.setGroup( "settings" ); 54 cfg.setGroup( "settings" );
55 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); 55 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
56 showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
56#endif 57#endif
57 58
58 59
59 initGui(); 60 initGui();
60 setupConnections(); 61 setupConnections();
61 62
62 progressDlg = 0; 63 progressDlg = 0;
63 timerId = startTimer( 100 ); 64 timerId = startTimer( 100 );
64} 65}
65 66
66NetworkPackageManager::~NetworkPackageManager() 67NetworkPackageManager::~NetworkPackageManager()
67{ 68{
68} 69}
69 70
70void NetworkPackageManager :: timerEvent ( QTimerEvent * ) 71void NetworkPackageManager :: timerEvent ( QTimerEvent * )
71{ 72{
72 killTimer( timerId ); 73 killTimer( timerId );
73 74
74// showProgressDialog(); 75// showProgressDialog();
75 // Add server names to listbox 76 // Add server names to listbox
76 updateData(); 77 updateData();
77 78
78// progressDlg->hide(); 79// progressDlg->hide();
79} 80}
@@ -103,59 +104,63 @@ void NetworkPackageManager :: updateData()
103 if ( activeItem != -1 ) 104 if ( activeItem != -1 )
104 serversList->setCurrentItem( activeItem ); 105 serversList->setCurrentItem( activeItem );
105 serverSelected( 0 ); 106 serverSelected( 0 );
106} 107}
107 108
108 109
109void NetworkPackageManager :: initGui() 110void NetworkPackageManager :: initGui()
110{ 111{
111 QLabel *l = new QLabel( "Servers", this ); 112 QLabel *l = new QLabel( "Servers", this );
112 serversList = new QComboBox( this ); 113 serversList = new QComboBox( this );
113 packagesList = new QListView( this ); 114 packagesList = new QListView( this );
114 update = new QPushButton( "Refresh List", this ); 115 update = new QPushButton( "Refresh List", this );
115 download = new QPushButton( "Download", this ); 116 download = new QPushButton( "Download", this );
116 upgrade = new QPushButton( "Upgrade", this ); 117 upgrade = new QPushButton( "Upgrade", this );
117 apply = new QPushButton( "Apply", this ); 118 apply = new QPushButton( "Apply", this );
118 119
119 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" ); 120 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" );
120 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" ); 121 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" );
121 hbox1->addWidget( l ); 122 hbox1->addWidget( l );
122 hbox1->addWidget( serversList ); 123 hbox1->addWidget( serversList );
123 124
124 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" ); 125 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" );
125 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" ); 126 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" );
126 127
127 char text[2]; 128
128 text[1] = '\0'; 129 if ( showJumpTo )
129 for ( int i = 0 ; i < 26 ; ++i ) 130 {
130 { 131 char text[2];
131 text[0] = 'A' + i; 132 text[1] = '\0';
132 LetterPushButton *b = new LetterPushButton( text, this ); 133 for ( int i = 0 ; i < 26 ; ++i )
133 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); 134 {
134 if ( i < 16 ) 135 text[0] = 'A' + i;
135 hbox3->addWidget( b ); 136 LetterPushButton *b = new LetterPushButton( text, this );
136 else 137 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
137 hbox4->addWidget( b ); 138 if ( i < 16 )
139 hbox3->addWidget( b );
140 else
141 hbox4->addWidget( b );
142 }
138 } 143 }
139 144
140 vbox->addWidget( packagesList ); 145 vbox->addWidget( packagesList );
141 packagesList->addColumn( "Packages" ); 146 packagesList->addColumn( "Packages" );
142 147
143 QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" ); 148 QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" );
144 hbox2->addWidget( update ); 149 hbox2->addWidget( update );
145 hbox2->addWidget( download ); 150 hbox2->addWidget( download );
146 hbox2->addWidget( upgrade ); 151 hbox2->addWidget( upgrade );
147 hbox2->addWidget( apply ); 152 hbox2->addWidget( apply );
148} 153}
149 154
150void NetworkPackageManager :: setupConnections() 155void NetworkPackageManager :: setupConnections()
151{ 156{
152 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); 157 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int )));
153 connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); 158 connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) );
154 connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); 159 connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) );
155 connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) ); 160 connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) );
156 connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); 161 connect( update, SIGNAL(released()), this, SLOT(updateServer()) );
157} 162}
158 163
159void NetworkPackageManager :: showProgressDialog( char *initialText ) 164void NetworkPackageManager :: showProgressDialog( char *initialText )
160{ 165{
161 if ( !progressDlg ) 166 if ( !progressDlg )
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h
index 7efa42c..fba8155 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.h
+++ b/noncore/settings/aqpkg/networkpkgmgr.h
@@ -32,45 +32,46 @@ class InstallData;
32class NetworkPackageManager : public QWidget 32class NetworkPackageManager : public QWidget
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35public: 35public:
36 /** construtor */ 36 /** construtor */
37 NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0); 37 NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0);
38 /** destructor */ 38 /** destructor */
39 ~NetworkPackageManager(); 39 ~NetworkPackageManager();
40 40
41 void updateData(); 41 void updateData();
42 42
43private: 43private:
44 DataManager *dataMgr; 44 DataManager *dataMgr;
45 45
46 QComboBox *serversList; 46 QComboBox *serversList;
47 QListView *packagesList; 47 QListView *packagesList;
48 QPushButton *update; 48 QPushButton *update;
49 QPushButton *upgrade; 49 QPushButton *upgrade;
50 QPushButton *download; 50 QPushButton *download;
51 QPushButton *apply; 51 QPushButton *apply;
52 52
53 ProgressDlg *progressDlg; 53 ProgressDlg *progressDlg;
54 QString currentlySelectedServer; 54 QString currentlySelectedServer;
55 55
56 bool showJumpTo;
56 int timerId; 57 int timerId;
57 58
58 void timerEvent ( QTimerEvent * ); 59 void timerEvent ( QTimerEvent * );
59 60
60 void initGui(); 61 void initGui();
61 void setupConnections(); 62 void setupConnections();
62 void showProgressDialog( char *initialText ); 63 void showProgressDialog( char *initialText );
63 InstallData dealWithItem( QCheckListItem *item ); 64 InstallData dealWithItem( QCheckListItem *item );
64 QString stickyOption; 65 QString stickyOption;
65 66
66public slots: 67public slots:
67 void serverSelected( int index ); 68 void serverSelected( int index );
68 void applyChanges(); 69 void applyChanges();
69 void upgradePackages(); 70 void upgradePackages();
70 void downloadPackage(); 71 void downloadPackage();
71 void updateServer(); 72 void updateServer();
72 void displayText( const QString &t ); 73 void displayText( const QString &t );
73 void letterPushed( QString t ); 74 void letterPushed( QString t );
74}; 75};
75 76
76#endif 77#endif
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index 9ee3a33..a18a178 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -45,59 +45,66 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const
45 45
46SettingsImpl :: ~SettingsImpl() 46SettingsImpl :: ~SettingsImpl()
47{ 47{
48 48
49} 49}
50 50
51bool SettingsImpl :: showDlg( int i ) 51bool SettingsImpl :: showDlg( int i )
52{ 52{
53 TabWidget->setCurrentPage( i ); 53 TabWidget->setCurrentPage( i );
54 showMaximized(); 54 showMaximized();
55 exec(); 55 exec();
56 56
57 if ( changed ) 57 if ( changed )
58 dataMgr->writeOutIpkgConf(); 58 dataMgr->writeOutIpkgConf();
59 59
60 return changed; 60 return changed;
61} 61}
62 62
63void SettingsImpl :: setupData() 63void SettingsImpl :: setupData()
64{ 64{
65 // add servers 65 // add servers
66 vector<Server>::iterator it; 66 vector<Server>::iterator it;
67 for ( it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it ) 67 for ( it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it )
68 { 68 {
69 if ( it->getServerName() == LOCAL_SERVER || it->getServerName() == LOCAL_IPKGS ) 69 if ( it->getServerName() == LOCAL_SERVER || it->getServerName() == LOCAL_IPKGS )
70 continue; 70 continue;
71 71
72 servers->insertItem( it->getServerName() ); 72 servers->insertItem( it->getServerName() );
73 } 73 }
74 74
75 // add destinations 75 // add destinations
76 vector<Destination>::iterator it2; 76 vector<Destination>::iterator it2;
77 for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 ) 77 for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 )
78 destinations->insertItem( it2->getDestinationName() ); 78 destinations->insertItem( it2->getDestinationName() );
79 79
80#ifdef QWS
81 Config cfg( "aqpkg" );
82 cfg.setGroup( "settings" );
83 jumpTo->setChecked( cfg.readBoolEntry( "showJumpTo", "true" ) );
84#else
85 jumpTo->setChecked( true );
86#endif
80} 87}
81 88
82//------------------ Servers tab ---------------------- 89//------------------ Servers tab ----------------------
83 90
84void SettingsImpl :: editServer( int sel ) 91void SettingsImpl :: editServer( int sel )
85{ 92{
86 currentSelectedServer = sel; 93 currentSelectedServer = sel;
87 Server *s = dataMgr->getServer( servers->currentText() ); 94 Server *s = dataMgr->getServer( servers->currentText() );
88 serverName = s->getServerName(); 95 serverName = s->getServerName();
89 servername->setText( s->getServerName() ); 96 servername->setText( s->getServerName() );
90 serverurl->setText( s->getServerUrl() ); 97 serverurl->setText( s->getServerUrl() );
91 active->setChecked( s->isServerActive() ); 98 active->setChecked( s->isServerActive() );
92} 99}
93 100
94void SettingsImpl :: newServer() 101void SettingsImpl :: newServer()
95{ 102{
96 newserver = true; 103 newserver = true;
97 servername->setText( "" ); 104 servername->setText( "" );
98 serverurl->setText( "" ); 105 serverurl->setText( "" );
99 servername->setFocus(); 106 servername->setFocus();
100 active->setChecked( true ); 107 active->setChecked( true );
101} 108}
102 109
103void SettingsImpl :: removeServer() 110void SettingsImpl :: removeServer()
@@ -203,24 +210,36 @@ void SettingsImpl :: changeDestinationDetails()
203 // Update list box 210 // Update list box
204 destinations->changeItem( newName, currentSelectedDestination ); 211 destinations->changeItem( newName, currentSelectedDestination );
205 } 212 }
206#ifdef QWS 213#ifdef QWS
207 QString key = newName; 214 QString key = newName;
208 key += "_linkToRoot"; 215 key += "_linkToRoot";
209 int val = d->linkToRoot(); 216 int val = d->linkToRoot();
210 cfg.writeEntry( key, val ); 217 cfg.writeEntry( key, val );
211#endif 218#endif
212 } 219 }
213 else 220 else
214 { 221 {
215 dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) ); 222 dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) );
216 destinations->insertItem( newName ); 223 destinations->insertItem( newName );
217 destinations->setCurrentItem( destinations->count() ); 224 destinations->setCurrentItem( destinations->count() );
218 newdestination = false; 225 newdestination = false;
219 226
220#ifdef QWS 227#ifdef QWS
221 QString key = newName; 228 QString key = newName;
222 key += "_linkToRoot"; 229 key += "_linkToRoot";
223 cfg.writeEntry( key, true ); 230 cfg.writeEntry( key, true );
224#endif 231#endif
225 } 232 }
226} 233}
234
235//------------------ General tab ----------------------
236
237void SettingsImpl :: toggleJumpTo( bool val )
238{
239#ifdef QWS
240 Config cfg( "aqpkg" );
241 cfg.setGroup( "settings" );
242 cfg.writeEntry( "showJumpTo", val );
243#endif
244}
245
diff --git a/noncore/settings/aqpkg/settingsimpl.h b/noncore/settings/aqpkg/settingsimpl.h
index bc231a1..971516b 100644
--- a/noncore/settings/aqpkg/settingsimpl.h
+++ b/noncore/settings/aqpkg/settingsimpl.h
@@ -28,25 +28,27 @@ public:
28 bool showDlg( int i ); 28 bool showDlg( int i );
29 29
30private: 30private:
31 DataManager *dataMgr; 31 DataManager *dataMgr;
32 QString serverName; 32 QString serverName;
33 QString destinationName; 33 QString destinationName;
34 int currentSelectedServer; 34 int currentSelectedServer;
35 int currentSelectedDestination; 35 int currentSelectedDestination;
36 bool changed; 36 bool changed;
37 bool newserver; 37 bool newserver;
38 bool newdestination; 38 bool newdestination;
39 39
40 void setupConnections(); 40 void setupConnections();
41 void setupData(); 41 void setupData();
42 42
43 void editServer( int s ); 43 void editServer( int s );
44 void changeServerDetails(); 44 void changeServerDetails();
45 void newServer(); 45 void newServer();
46 void removeServer(); 46 void removeServer();
47 47
48 void editDestination( int s ); 48 void editDestination( int s );
49 void changeDestinationDetails(); 49 void changeDestinationDetails();
50 void newDestination(); 50 void newDestination();
51 void removeDestination(); 51 void removeDestination();
52
53 void toggleJumpTo( bool val );
52}; 54};