-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 83f983a..2ea70e0 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -1,147 +1,146 @@ | |||
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 | #ifdef QWS | 18 | #ifdef QWS |
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #include <qmultilineedit.h> | 22 | #include <qmultilineedit.h> |
23 | #include <qdialog.h> | 23 | #include <qdialog.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qcheckbox.h> | 25 | #include <qcheckbox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | 27 | ||
28 | 28 | ||
29 | #include "datamgr.h" | 29 | #include "datamgr.h" |
30 | #include "instoptionsimpl.h" | 30 | #include "instoptionsimpl.h" |
31 | #include "destination.h" | 31 | #include "destination.h" |
32 | #include "installdlgimpl.h" | 32 | #include "installdlgimpl.h" |
33 | #include "global.h" | 33 | #include "global.h" |
34 | 34 | ||
35 | InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) | 35 | InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) |
36 | : InstallDlg( parent, name, modal, fl ) | 36 | : InstallDlg( parent, name, modal, fl ) |
37 | { | 37 | { |
38 | pIpkg = 0; | 38 | pIpkg = 0; |
39 | upgradePackages = false; | 39 | upgradePackages = false; |
40 | dataMgr = dataManager; | 40 | dataMgr = dataManager; |
41 | vector<Destination>::iterator dit; | 41 | vector<Destination>::iterator dit; |
42 | 42 | ||
43 | QString defaultDest = "root"; | 43 | QString defaultDest = "root"; |
44 | #ifdef QWS | 44 | #ifdef QWS |
45 | Config cfg( "aqpkg" ); | 45 | Config cfg( "aqpkg" ); |
46 | cfg.setGroup( "settings" ); | 46 | cfg.setGroup( "settings" ); |
47 | defaultDest = cfg.readEntry( "dest", "root" ); | 47 | defaultDest = cfg.readEntry( "dest", "root" ); |
48 | 48 | ||
49 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) | 49 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) |
50 | // flags = cfg.readNumEntry( "installFlags", MAKE_LINKS ); | 50 | flags = cfg.readNumEntry( "installFlags", 0 ); |
51 | flags = 0; | ||
52 | #else | 51 | #else |
53 | flags = 0; | 52 | flags = 0; |
54 | #endif | 53 | #endif |
55 | 54 | ||
56 | // Output text is read only | 55 | // Output text is read only |
57 | output->setReadOnly( true ); | 56 | output->setReadOnly( true ); |
58 | QFont f( "helvetica" ); | 57 | QFont f( "helvetica" ); |
59 | f.setPointSize( 10 ); | 58 | f.setPointSize( 10 ); |
60 | output->setFont( f ); | 59 | output->setFont( f ); |
61 | 60 | ||
62 | 61 | ||
63 | // setup destination data | 62 | // setup destination data |
64 | int defIndex = 0; | 63 | int defIndex = 0; |
65 | int i; | 64 | int i; |
66 | for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i ) | 65 | for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i ) |
67 | { | 66 | { |
68 | destination->insertItem( dit->getDestinationName() ); | 67 | destination->insertItem( dit->getDestinationName() ); |
69 | if ( dit->getDestinationName() == defaultDest ) | 68 | if ( dit->getDestinationName() == defaultDest ) |
70 | defIndex = i; | 69 | defIndex = i; |
71 | } | 70 | } |
72 | 71 | ||
73 | destination->setCurrentItem( defIndex ); | 72 | destination->setCurrentItem( defIndex ); |
74 | 73 | ||
75 | vector<InstallData>::iterator it; | 74 | vector<InstallData>::iterator it; |
76 | // setup package data | 75 | // setup package data |
77 | QString remove = "Remove\n"; | 76 | QString remove = "Remove\n"; |
78 | QString install = "\nInstall\n"; | 77 | QString install = "\nInstall\n"; |
79 | QString upgrade = "\nUpgrade\n"; | 78 | QString upgrade = "\nUpgrade\n"; |
80 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) | 79 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) |
81 | { | 80 | { |
82 | InstallData item = *it; | 81 | InstallData item = *it; |
83 | if ( item.option == "I" ) | 82 | if ( item.option == "I" ) |
84 | { | 83 | { |
85 | installList.push_back( item ); | 84 | installList.push_back( item ); |
86 | install += " " + item.packageName + "\n"; | 85 | install += " " + item.packageName + "\n"; |
87 | } | 86 | } |
88 | else if ( item.option == "D" ) | 87 | else if ( item.option == "D" ) |
89 | { | 88 | { |
90 | removeList.push_back( item ); | 89 | removeList.push_back( item ); |
91 | remove += " " + item.packageName + "\n"; | 90 | remove += " " + item.packageName + "\n"; |
92 | } | 91 | } |
93 | else if ( item.option == "U" || item.option == "R" ) | 92 | else if ( item.option == "U" || item.option == "R" ) |
94 | { | 93 | { |
95 | updateList.push_back( item ); | 94 | updateList.push_back( item ); |
96 | upgrade += " " + item.packageName + "\n"; | 95 | upgrade += " " + item.packageName + "\n"; |
97 | } | 96 | } |
98 | } | 97 | } |
99 | 98 | ||
100 | output->setText( remove + install + upgrade ); | 99 | output->setText( remove + install + upgrade ); |
101 | } | 100 | } |
102 | 101 | ||
103 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) | 102 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) |
104 | : InstallDlg( parent, name, modal, fl ) | 103 | : InstallDlg( parent, name, modal, fl ) |
105 | { | 104 | { |
106 | pIpkg = ipkg; | 105 | pIpkg = ipkg; |
107 | output->setText( initialText ); | 106 | output->setText( initialText ); |
108 | } | 107 | } |
109 | 108 | ||
110 | 109 | ||
111 | InstallDlgImpl::~InstallDlgImpl() | 110 | InstallDlgImpl::~InstallDlgImpl() |
112 | { | 111 | { |
113 | } | 112 | } |
114 | 113 | ||
115 | bool InstallDlgImpl :: showDlg() | 114 | bool InstallDlgImpl :: showDlg() |
116 | { | 115 | { |
117 | showMaximized(); | 116 | showMaximized(); |
118 | bool ret = exec(); | 117 | bool ret = exec(); |
119 | 118 | ||
120 | return ret; | 119 | return ret; |
121 | } | 120 | } |
122 | 121 | ||
123 | void InstallDlgImpl :: optionsSelected() | 122 | void InstallDlgImpl :: optionsSelected() |
124 | { | 123 | { |
125 | InstallOptionsDlgImpl opt( flags, this, "Option", true ); | 124 | InstallOptionsDlgImpl opt( flags, this, "Option", true ); |
126 | opt.exec(); | 125 | opt.exec(); |
127 | 126 | ||
128 | // set options selected from dialog | 127 | // set options selected from dialog |
129 | flags = 0; | 128 | flags = 0; |
130 | if ( opt.forceDepends->isChecked() ) | 129 | if ( opt.forceDepends->isChecked() ) |
131 | flags |= FORCE_DEPENDS; | 130 | flags |= FORCE_DEPENDS; |
132 | if ( opt.forceReinstall->isChecked() ) | 131 | if ( opt.forceReinstall->isChecked() ) |
133 | flags |= FORCE_REINSTALL; | 132 | flags |= FORCE_REINSTALL; |
134 | if ( opt.forceRemove->isChecked() ) | 133 | if ( opt.forceRemove->isChecked() ) |
135 | flags |= FORCE_REMOVE; | 134 | flags |= FORCE_REMOVE; |
136 | if ( opt.forceOverwrite->isChecked() ) | 135 | if ( opt.forceOverwrite->isChecked() ) |
137 | flags |= FORCE_OVERWRITE; | 136 | flags |= FORCE_OVERWRITE; |
138 | 137 | ||
139 | #ifdef QWS | 138 | #ifdef QWS |
140 | Config cfg( "aqpkg" ); | 139 | Config cfg( "aqpkg" ); |
141 | cfg.setGroup( "settings" ); | 140 | cfg.setGroup( "settings" ); |
142 | cfg.writeEntry( "installFlags", flags ); | 141 | cfg.writeEntry( "installFlags", flags ); |
143 | #endif | 142 | #endif |
144 | } | 143 | } |
145 | 144 | ||
146 | void InstallDlgImpl :: installSelected() | 145 | void InstallDlgImpl :: installSelected() |
147 | { | 146 | { |