Diffstat (limited to 'noncore/settings/packagemanager/oipkgconfigdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index d134651..7941ab8 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -18,45 +18,44 @@ | |||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "oipkgconfigdlg.h" | 32 | #include "oipkgconfigdlg.h" |
33 | 33 | ||
34 | #include <qpe/resource.h> | ||
35 | |||
34 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
35 | #include <qcombobox.h> | 37 | #include <qcombobox.h> |
36 | #include <qgroupbox.h> | 38 | #include <qgroupbox.h> |
37 | #include <qlabel.h> | 39 | #include <qlabel.h> |
38 | #include <qlineedit.h> | 40 | #include <qlineedit.h> |
39 | #include <qlistbox.h> | 41 | #include <qlistbox.h> |
40 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
41 | #include <qscrollview.h> | 43 | #include <qscrollview.h> |
42 | #include <qwhatsthis.h> | 44 | #include <qwhatsthis.h> |
43 | 45 | ||
44 | #include <qpe/resource.h> | ||
45 | |||
46 | using namespace Opie::Ui; | ||
47 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) | 46 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) |
48 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 47 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
49 | , m_ipkg( ipkg ) | 48 | , m_ipkg( ipkg ) |
50 | , m_configs( 0x0 ) | 49 | , m_configs( 0x0 ) |
51 | , m_installOptions( installOptions ) | 50 | , m_installOptions( installOptions ) |
52 | , m_serverNew( false ) | 51 | , m_serverNew( false ) |
53 | , m_serverCurrent( -1 ) | 52 | , m_serverCurrent( -1 ) |
54 | , m_destNew( false ) | 53 | , m_destNew( false ) |
55 | , m_destCurrent( -1 ) | 54 | , m_destCurrent( -1 ) |
56 | , m_layout( this, 2, 4 ) | 55 | , m_layout( this, 2, 4 ) |
57 | , m_tabWidget( this ) | 56 | , m_tabWidget( this ) |
58 | { | 57 | { |
59 | setCaption( tr( "Configuration" ) ); | 58 | setCaption( tr( "Configuration" ) ); |
60 | 59 | ||
61 | // Initialize configuration widgets | 60 | // Initialize configuration widgets |
62 | if ( !installOptions ) | 61 | if ( !installOptions ) |
@@ -88,57 +87,57 @@ OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *paren | |||
88 | //showMaximized(); | 87 | //showMaximized(); |
89 | } | 88 | } |
90 | 89 | ||
91 | void OIpkgConfigDlg::accept() | 90 | void OIpkgConfigDlg::accept() |
92 | { | 91 | { |
93 | // Save server, destination and proxy configuration | 92 | // Save server, destination and proxy configuration |
94 | if ( !m_installOptions ) | 93 | if ( !m_installOptions ) |
95 | { | 94 | { |
96 | // Update proxy information before saving settings | 95 | // Update proxy information before saving settings |
97 | OConfItem *confItem = findConfItem( OConfItem::Option, "http_proxy" ); | 96 | OConfItem *confItem = findConfItem( OConfItem::Option, "http_proxy" ); |
98 | if ( confItem ) | 97 | if ( confItem ) |
99 | { | 98 | { |
100 | confItem->setValue( m_proxyHttpServer->text() ); | 99 | confItem->setValue( m_proxyHttpServer->text() ); |
101 | confItem->setActive( m_proxyHttpActive->isChecked() ); | 100 | confItem->setActive( m_proxyHttpActive->isChecked() ); |
102 | } | 101 | } |
103 | else | 102 | else |
104 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "http_proxy", | 103 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", |
105 | m_proxyHttpServer->text(), m_proxyHttpActive->isChecked() ) ); | 104 | m_proxyHttpServer->text(), m_proxyHttpActive->isChecked() ) ); |
106 | 105 | ||
107 | confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); | 106 | confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); |
108 | if ( confItem ) | 107 | if ( confItem ) |
109 | { | 108 | { |
110 | confItem->setValue( m_proxyFtpServer->text() ); | 109 | confItem->setValue( m_proxyFtpServer->text() ); |
111 | confItem->setActive( m_proxyFtpActive->isChecked() ); | 110 | confItem->setActive( m_proxyFtpActive->isChecked() ); |
112 | } | 111 | } |
113 | else | 112 | else |
114 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "ftp_proxy", | 113 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", |
115 | m_proxyFtpServer->text(), m_proxyFtpActive->isChecked() ) ); | 114 | m_proxyFtpServer->text(), m_proxyFtpActive->isChecked() ) ); |
116 | 115 | ||
117 | confItem = findConfItem( OConfItem::Option, "proxy_username" ); | 116 | confItem = findConfItem( OConfItem::Option, "proxy_username" ); |
118 | if ( confItem ) | 117 | if ( confItem ) |
119 | confItem->setValue( m_proxyUsername->text() ); | 118 | confItem->setValue( m_proxyUsername->text() ); |
120 | else | 119 | else |
121 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "proxy_username", | 120 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", |
122 | m_proxyUsername->text() ) ); | 121 | m_proxyUsername->text() ) ); |
123 | 122 | ||
124 | confItem = findConfItem( OConfItem::Option, "proxy_password" ); | 123 | confItem = findConfItem( OConfItem::Option, "proxy_password" ); |
125 | if ( confItem ) | 124 | if ( confItem ) |
126 | confItem->setValue( m_proxyPassword->text() ); | 125 | confItem->setValue( m_proxyPassword->text() ); |
127 | else | 126 | else |
128 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "proxy_password", | 127 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", |
129 | m_proxyPassword->text() ) ); | 128 | m_proxyPassword->text() ) ); |
130 | 129 | ||
131 | m_ipkg->setConfigItems( m_configs ); | 130 | m_ipkg->setConfigItems( m_configs ); |
132 | } | 131 | } |
133 | 132 | ||
134 | // Save options configuration | 133 | // Save options configuration |
135 | int options = 0; | 134 | int options = 0; |
136 | if ( m_optForceDepends->isChecked() ) | 135 | if ( m_optForceDepends->isChecked() ) |
137 | options |= FORCE_DEPENDS; | 136 | options |= FORCE_DEPENDS; |
138 | if ( m_optForceReinstall->isChecked() ) | 137 | if ( m_optForceReinstall->isChecked() ) |
139 | options |= FORCE_REINSTALL; | 138 | options |= FORCE_REINSTALL; |
140 | if ( m_optForceRemove->isChecked() ) | 139 | if ( m_optForceRemove->isChecked() ) |
141 | options |= FORCE_REMOVE; | 140 | options |= FORCE_REMOVE; |
142 | if ( m_optForceOverwrite->isChecked() ) | 141 | if ( m_optForceOverwrite->isChecked() ) |
143 | options |= FORCE_OVERWRITE; | 142 | options |= FORCE_OVERWRITE; |
144 | m_ipkg->setIpkgExecOptions( options ); | 143 | m_ipkg->setIpkgExecOptions( options ); |
@@ -519,33 +518,33 @@ void OIpkgConfigDlg::slotServerUpdate() | |||
519 | server->setActive( m_serverActive->isChecked() ); | 518 | server->setActive( m_serverActive->isChecked() ); |
520 | 519 | ||
521 | // Check if server name has changed, if it has then we need to replace the key in the map | 520 | // Check if server name has changed, if it has then we need to replace the key in the map |
522 | if ( m_serverCurrName != newName ) | 521 | if ( m_serverCurrName != newName ) |
523 | { | 522 | { |
524 | // Update server name | 523 | // Update server name |
525 | server->setName( newName ); | 524 | server->setName( newName ); |
526 | 525 | ||
527 | // Update list box | 526 | // Update list box |
528 | m_serverList->changeItem( newName, m_serverCurrent ); | 527 | m_serverList->changeItem( newName, m_serverCurrent ); |
529 | } | 528 | } |
530 | } | 529 | } |
531 | } | 530 | } |
532 | else | 531 | else |
533 | { | 532 | { |
534 | // Add new destination to configuration list | 533 | // Add new destination to configuration list |
535 | m_configs->append( new OConfItem( QString::null, OConfItem::Source, newName, | 534 | m_configs->append( new OConfItem( OConfItem::Source, newName, |
536 | m_serverLocation->text(), m_serverActive->isChecked() ) ); | 535 | m_serverLocation->text(), m_serverActive->isChecked() ) ); |
537 | m_configs->sort(); | 536 | m_configs->sort(); |
538 | 537 | ||
539 | m_serverList->insertItem( newName ); | 538 | m_serverList->insertItem( newName ); |
540 | m_serverList->setCurrentItem( m_serverList->count() ); | 539 | m_serverList->setCurrentItem( m_serverList->count() ); |
541 | m_serverNew = false; | 540 | m_serverNew = false; |
542 | m_serverList->insertItem( newName ); | 541 | m_serverList->insertItem( newName ); |
543 | } | 542 | } |
544 | } | 543 | } |
545 | 544 | ||
546 | void OIpkgConfigDlg::slotDestEdit( int index ) | 545 | void OIpkgConfigDlg::slotDestEdit( int index ) |
547 | { | 546 | { |
548 | m_destNew = false; | 547 | m_destNew = false; |
549 | m_destCurrent = index; | 548 | m_destCurrent = index; |
550 | 549 | ||
551 | // Find selected destination in list | 550 | // Find selected destination in list |
@@ -605,25 +604,25 @@ void OIpkgConfigDlg::slotDestUpdate() | |||
605 | destination->setActive( m_destActive->isChecked() ); | 604 | destination->setActive( m_destActive->isChecked() ); |
606 | 605 | ||
607 | // Check if destination name has changed, if it has then we need to replace the key in the map | 606 | // Check if destination name has changed, if it has then we need to replace the key in the map |
608 | if ( m_destCurrName != newName ) | 607 | if ( m_destCurrName != newName ) |
609 | { | 608 | { |
610 | // Update destination name | 609 | // Update destination name |
611 | destination->setName( newName ); | 610 | destination->setName( newName ); |
612 | 611 | ||
613 | // Update list box | 612 | // Update list box |
614 | m_destList->changeItem( newName, m_destCurrent ); | 613 | m_destList->changeItem( newName, m_destCurrent ); |
615 | } | 614 | } |
616 | } | 615 | } |
617 | } | 616 | } |
618 | else | 617 | else |
619 | { | 618 | { |
620 | // Add new destination to configuration list | 619 | // Add new destination to configuration list |
621 | m_configs->append( new OConfItem( QString::null, OConfItem::Destination, newName, | 620 | m_configs->append( new OConfItem( OConfItem::Destination, newName, |
622 | m_destLocation->text(), m_destActive->isChecked() ) ); | 621 | m_destLocation->text(), m_destActive->isChecked() ) ); |
623 | m_configs->sort(); | 622 | m_configs->sort(); |
624 | 623 | ||
625 | m_destList->insertItem( newName ); | 624 | m_destList->insertItem( newName ); |
626 | m_destList->setCurrentItem( m_destList->count() ); | 625 | m_destList->setCurrentItem( m_destList->count() ); |
627 | m_destNew = false; | 626 | m_destNew = false; |
628 | } | 627 | } |
629 | } | 628 | } |