-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 65aaa32..19fe46a 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -1,169 +1,169 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | installdlgimpl.cpp - description | 2 | installdlgimpl.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Aug 26 2002 | 4 | begin : Mon Aug 26 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include <stdio.h> | 18 | #include <stdio.h> |
19 | 19 | ||
20 | #ifdef QWS | 20 | #ifdef QWS |
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/storage.h> | 24 | #include <qpe/storage.h> |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include <qcheckbox.h> | 27 | #include <qcheckbox.h> |
28 | #include <qcombobox.h> | 28 | #include <qcombobox.h> |
29 | #include <qdialog.h> | 29 | #include <qdialog.h> |
30 | #include <qgroupbox.h> | 30 | #include <qgroupbox.h> |
31 | #include <qmultilineedit.h> | 31 | #include <qmultilineedit.h> |
32 | #include <qlabel.h> | 32 | #include <qlabel.h> |
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | 35 | ||
36 | #include "datamgr.h" | 36 | #include "datamgr.h" |
37 | #include "destination.h" | 37 | #include "destination.h" |
38 | #include "instoptionsimpl.h" | 38 | #include "instoptionsimpl.h" |
39 | #include "installdlgimpl.h" | 39 | #include "installdlgimpl.h" |
40 | #include "ipkg.h" | 40 | #include "ipkg.h" |
41 | #include "utils.h" | 41 | #include "utils.h" |
42 | #include "global.h" | 42 | #include "global.h" |
43 | 43 | ||
44 | InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ) | 44 | InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title ) |
45 | : QWidget( 0, 0, 0 ) | 45 | : QWidget( 0, 0, 0 ) |
46 | { | 46 | { |
47 | setCaption( title ); | 47 | setCaption( title ); |
48 | init( TRUE ); | 48 | init( TRUE ); |
49 | 49 | ||
50 | pIpkg = 0; | 50 | pIpkg = 0; |
51 | upgradePackages = false; | 51 | upgradePackages = false; |
52 | dataMgr = dataManager; | 52 | dataMgr = dataManager; |
53 | vector<Destination>::iterator dit; | 53 | vector<Destination>::iterator dit; |
54 | 54 | ||
55 | QString defaultDest = "root"; | 55 | QString defaultDest = "root"; |
56 | #ifdef QWS | 56 | #ifdef QWS |
57 | Config cfg( "aqpkg" ); | 57 | Config cfg( "aqpkg" ); |
58 | cfg.setGroup( "settings" ); | 58 | cfg.setGroup( "settings" ); |
59 | defaultDest = cfg.readEntry( "dest", "root" ); | 59 | defaultDest = cfg.readEntry( "dest", "root" ); |
60 | 60 | ||
61 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) | 61 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) |
62 | flags = cfg.readNumEntry( "installFlags", 0 ); | 62 | flags = cfg.readNumEntry( "installFlags", 0 ); |
63 | #else | 63 | #else |
64 | flags = 0; | 64 | flags = 0; |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | // Output text is read only | 67 | // Output text is read only |
68 | output->setReadOnly( true ); | 68 | output->setReadOnly( true ); |
69 | //QFont f( "helvetica" ); | 69 | //QFont f( "helvetica" ); |
70 | //f.setPointSize( 10 ); | 70 | //f.setPointSize( 10 ); |
71 | //output->setFont( f ); | 71 | //output->setFont( f ); |
72 | 72 | ||
73 | 73 | ||
74 | // setup destination data | 74 | // setup destination data |
75 | int defIndex = 0; | 75 | int defIndex = 0; |
76 | int i; | 76 | int i; |
77 | for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i ) | 77 | for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i ) |
78 | { | 78 | { |
79 | destination->insertItem( dit->getDestinationName() ); | 79 | destination->insertItem( dit->getDestinationName() ); |
80 | if ( dit->getDestinationName() == defaultDest ) | 80 | if ( dit->getDestinationName() == defaultDest ) |
81 | defIndex = i; | 81 | defIndex = i; |
82 | } | 82 | } |
83 | 83 | ||
84 | destination->setCurrentItem( defIndex ); | 84 | destination->setCurrentItem( defIndex ); |
85 | 85 | ||
86 | vector<InstallData>::iterator it; | 86 | vector<InstallData>::iterator it; |
87 | // setup package data | 87 | // setup package data |
88 | QString remove = tr( "Remove\n" ); | 88 | QString remove = tr( "Remove\n" ); |
89 | QString install = tr( "Install\n" ); | 89 | QString install = tr( "Install\n" ); |
90 | QString upgrade = tr( "Upgrade\n" ); | 90 | QString upgrade = tr( "Upgrade\n" ); |
91 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) | 91 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) |
92 | { | 92 | { |
93 | InstallData item = *it; | 93 | InstallData item = *it; |
94 | if ( item.option == "I" ) | 94 | if ( item.option == "I" ) |
95 | { | 95 | { |
96 | installList.push_back( item ); | 96 | installList.push_back( item ); |
97 | install.append( QString( " %1\n" ).arg( item.packageName ) ); | 97 | install.append( QString( " %1\n" ).arg( item.packageName ) ); |
98 | } | 98 | } |
99 | else if ( item.option == "D" ) | 99 | else if ( item.option == "D" ) |
100 | { | 100 | { |
101 | removeList.push_back( item ); | 101 | removeList.push_back( item ); |
102 | remove.append( QString( " %1\n" ).arg( item.packageName ) ); | 102 | remove.append( QString( " %1\n" ).arg( item.packageName ) ); |
103 | } | 103 | } |
104 | else if ( item.option == "U" || item.option == "R" ) | 104 | else if ( item.option == "U" || item.option == "R" ) |
105 | { | 105 | { |
106 | updateList.push_back( item ); | 106 | updateList.push_back( item ); |
107 | QString type; | 107 | QString type; |
108 | if ( item.option == "R" ) | 108 | if ( item.option == "R" ) |
109 | type = tr( "(ReInstall)" ); | 109 | type = tr( "(ReInstall)" ); |
110 | else | 110 | else |
111 | type = tr( "(Upgrade)" ); | 111 | type = tr( "(Upgrade)" ); |
112 | upgrade.append( QString( " %1 %2\n" ).arg( item.packageName ).arg( type ) ); | 112 | upgrade.append( QString( " %1 %2\n" ).arg( item.packageName ).arg( type ) ); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); | 116 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); |
117 | 117 | ||
118 | displayAvailableSpace( destination->currentText() ); | 118 | displayAvailableSpace( destination->currentText() ); |
119 | } | 119 | } |
120 | 120 | ||
121 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ) | 121 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) |
122 | : QWidget( 0, 0, 0 ) | 122 | : QWidget( 0, 0, 0 ) |
123 | { | 123 | { |
124 | setCaption( title ); | 124 | setCaption( title ); |
125 | init( FALSE ); | 125 | init( FALSE ); |
126 | pIpkg = ipkg; | 126 | pIpkg = ipkg; |
127 | output->setText( initialText ); | 127 | output->setText( initialText ); |
128 | } | 128 | } |
129 | 129 | ||
130 | 130 | ||
131 | InstallDlgImpl::~InstallDlgImpl() | 131 | InstallDlgImpl::~InstallDlgImpl() |
132 | { | 132 | { |
133 | if ( pIpkg ) | 133 | if ( pIpkg ) |
134 | delete pIpkg; | 134 | delete pIpkg; |
135 | } | 135 | } |
136 | 136 | ||
137 | void InstallDlgImpl :: init( bool displayextrainfo ) | 137 | void InstallDlgImpl :: init( bool displayextrainfo ) |
138 | { | 138 | { |
139 | QGridLayout *layout = new QGridLayout( this ); | 139 | QGridLayout *layout = new QGridLayout( this ); |
140 | layout->setSpacing( 4 ); | 140 | layout->setSpacing( 4 ); |
141 | layout->setMargin( 4 ); | 141 | layout->setMargin( 4 ); |
142 | 142 | ||
143 | if ( displayextrainfo ) | 143 | if ( displayextrainfo ) |
144 | { | 144 | { |
145 | QLabel *label = new QLabel( tr( "Destination" ), this ); | 145 | QLabel *label = new QLabel( tr( "Destination" ), this ); |
146 | layout->addWidget( label, 0, 0 ); | 146 | layout->addWidget( label, 0, 0 ); |
147 | destination = new QComboBox( FALSE, this ); | 147 | destination = new QComboBox( FALSE, this ); |
148 | layout->addWidget( destination, 0, 1 ); | 148 | layout->addWidget( destination, 0, 1 ); |
149 | connect( destination, SIGNAL( highlighted( const QString & ) ), | 149 | connect( destination, SIGNAL( highlighted( const QString & ) ), |
150 | this, SLOT( displayAvailableSpace( const QString & ) ) ); | 150 | this, SLOT( displayAvailableSpace( const QString & ) ) ); |
151 | 151 | ||
152 | QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); | 152 | QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); |
153 | layout->addWidget( label2, 1, 0 ); | 153 | layout->addWidget( label2, 1, 0 ); |
154 | txtAvailableSpace = new QLabel( "", this ); | 154 | txtAvailableSpace = new QLabel( "", this ); |
155 | layout->addWidget( txtAvailableSpace, 1, 1 ); | 155 | layout->addWidget( txtAvailableSpace, 1, 1 ); |
156 | } | 156 | } |
157 | else | 157 | else |
158 | { | 158 | { |
159 | destination = 0x0; | 159 | destination = 0x0; |
160 | txtAvailableSpace = 0x0; | 160 | txtAvailableSpace = 0x0; |
161 | } | 161 | } |
162 | 162 | ||
163 | QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); | 163 | QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); |
164 | GroupBox2->layout()->setSpacing( 0 ); | 164 | GroupBox2->layout()->setSpacing( 0 ); |
165 | GroupBox2->layout()->setMargin( 4 ); | 165 | GroupBox2->layout()->setMargin( 4 ); |
166 | 166 | ||
167 | QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); | 167 | QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); |
168 | output = new QMultiLineEdit( GroupBox2 ); | 168 | output = new QMultiLineEdit( GroupBox2 ); |
169 | GroupBox2Layout->addWidget( output ); | 169 | GroupBox2Layout->addWidget( output ); |