summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/installdlgimpl.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp55
1 files changed, 26 insertions, 29 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index db9a259..485fe3d 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -14,12 +14,13 @@
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#ifdef QWS 18#ifdef QWS
19#include <qpe/config.h> 19#include <qpe/config.h>
20#include <qpe/qpeapplication.h>
20#endif 21#endif
21 22
22#include <qmultilineedit.h> 23#include <qmultilineedit.h>
23#include <qdialog.h> 24#include <qdialog.h>
24#include <qcombobox.h> 25#include <qcombobox.h>
25#include <qcheckbox.h> 26#include <qcheckbox.h>
@@ -88,21 +89,21 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
88 { 89 {
89 removeList.push_back( item ); 90 removeList.push_back( item );
90 remove += " " + item.packageName + "\n"; 91 remove += " " + item.packageName + "\n";
91 } 92 }
92 else if ( item.option == "U" || item.option == "R" ) 93 else if ( item.option == "U" || item.option == "R" )
93 { 94 {
94 updateList.push_back( item ); 95 updateList.push_back( item );
95 QString type = " (Upgrade)"; 96 QString type = " (Upgrade)";
96 if ( item.option == "R" ) 97 if ( item.option == "R" )
97 type = " (ReInstall)"; 98 type = " (ReInstall)";
98 upgrade += " " + item.packageName + type + "\n"; 99 upgrade += " " + item.packageName + type + "\n";
99 } 100 }
100 } 101 }
101 102
102 output->setText( remove + install + upgrade ); 103 output->setText( remove + install + upgrade );
103} 104}
104 105
105InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) 106InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl )
106 : InstallDlg( parent, name, modal, fl ) 107 : InstallDlg( parent, name, modal, fl )
107{ 108{
108 pIpkg = ipkg; 109 pIpkg = ipkg;
@@ -113,50 +114,45 @@ InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent
113InstallDlgImpl::~InstallDlgImpl() 114InstallDlgImpl::~InstallDlgImpl()
114{ 115{
115} 116}
116 117
117bool InstallDlgImpl :: showDlg() 118bool InstallDlgImpl :: showDlg()
118{ 119{
119 showMaximized(); 120 showMaximized();
120 bool ret = exec(); 121 bool ret = exec();
121 122
122 return ret; 123 return ret;
123} 124}
124 125
125void InstallDlgImpl :: optionsSelected() 126void InstallDlgImpl :: optionsSelected()
126{ 127{
127 InstallOptionsDlgImpl opt( flags, this, "Option", true ); 128 InstallOptionsDlgImpl opt( flags, this, "Option", true );
128 opt.exec(); 129 opt.exec();
129 130
130 // set options selected from dialog 131 // set options selected from dialog
131 flags = 0; 132 flags = opt.getFlags();
132 if ( opt.forceDepends->isChecked() )
133 flags |= FORCE_DEPENDS;
134 if ( opt.forceReinstall->isChecked() )
135 flags |= FORCE_REINSTALL;
136 if ( opt.forceRemove->isChecked() )
137 flags |= FORCE_REMOVE;
138 if ( opt.forceOverwrite->isChecked() )
139 flags |= FORCE_OVERWRITE;
140 133
141#ifdef QWS 134#ifdef QWS
142 Config cfg( "aqpkg" ); 135 Config cfg( "aqpkg" );
143 cfg.setGroup( "settings" ); 136 cfg.setGroup( "settings" );
144 cfg.writeEntry( "installFlags", flags ); 137 cfg.writeEntry( "installFlags", flags );
145#endif 138#endif
146} 139}
147 140
148void InstallDlgImpl :: installSelected() 141void InstallDlgImpl :: installSelected()
149{ 142{
150 if ( btnInstall->text() == "Close" ) 143
151 { 144 if ( btnInstall->text() == "Close" )
152 done( 1 ); 145 {
153 return; 146 done( 1 );
154 } 147 return;
148 }
155 149
156 btnInstall->setEnabled( false ); 150 // Disable buttons
151 btnOptions->setEnabled( false );
152 btnInstall->setEnabled( false );
157 153
158 if ( pIpkg ) 154 if ( pIpkg )
159 { 155 {
160 output->setText( "" ); 156 output->setText( "" );
161 157
162 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 158 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
@@ -180,13 +176,13 @@ void InstallDlgImpl :: installSelected()
180#endif 176#endif
181 177
182 pIpkg = new Ipkg; 178 pIpkg = new Ipkg;
183 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 179 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
184 180
185 // First run through the remove list, then the install list then the upgrade list 181 // First run through the remove list, then the install list then the upgrade list
186 vector<InstallData>::iterator it; 182 vector<InstallData>::iterator it;
187 pIpkg->setOption( "remove" ); 183 pIpkg->setOption( "remove" );
188 for ( it = removeList.begin() ; it != removeList.end() ; ++it ) 184 for ( it = removeList.begin() ; it != removeList.end() ; ++it )
189 { 185 {
190 pIpkg->setDestination( it->destination->getDestinationName() ); 186 pIpkg->setDestination( it->destination->getDestinationName() );
191 pIpkg->setDestinationDir( it->destination->getDestinationPath() ); 187 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
192 pIpkg->setPackage( it->packageName ); 188 pIpkg->setPackage( it->packageName );
@@ -227,13 +223,14 @@ void InstallDlgImpl :: installSelected()
227 pIpkg->runIpkg(); 223 pIpkg->runIpkg();
228 } 224 }
229 225
230 delete pIpkg; 226 delete pIpkg;
231 } 227 }
232 228
233 btnInstall->setEnabled( true ); 229 btnOptions->setEnabled( true );
230 btnInstall->setEnabled( true );
234 btnInstall->setText( tr( "Close" ) ); 231 btnInstall->setText( tr( "Close" ) );
235} 232}
236 233
237void InstallDlgImpl :: displayText(const QString &text ) 234void InstallDlgImpl :: displayText(const QString &text )
238{ 235{
239 QString t = output->text() + "\n" + text; 236 QString t = output->text() + "\n" + text;