-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 592de3e..74e7137 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -62,65 +62,102 @@ OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *paren | |||
62 | { | 62 | { |
63 | initServerWidget(); | 63 | initServerWidget(); |
64 | initDestinationWidget(); | 64 | initDestinationWidget(); |
65 | initProxyWidget(); | 65 | initProxyWidget(); |
66 | } | 66 | } |
67 | initOptionsWidget(); | 67 | initOptionsWidget(); |
68 | 68 | ||
69 | // Load configuration information | 69 | // Load configuration information |
70 | initData(); | 70 | initData(); |
71 | 71 | ||
72 | // Setup tabs for all info | 72 | // Setup tabs for all info |
73 | m_layout.addWidget( &m_tabWidget ); | 73 | m_layout.addWidget( &m_tabWidget ); |
74 | if ( !m_installOptions ) | 74 | if ( !m_installOptions ) |
75 | { | 75 | { |
76 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); | 76 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); |
77 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); | 77 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); |
78 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); | 78 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); |
79 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 79 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
80 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); | 80 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); |
81 | } | 81 | } |
82 | else | 82 | else |
83 | { | 83 | { |
84 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 84 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
85 | } | 85 | } |
86 | 86 | ||
87 | //showMaximized(); | 87 | //showMaximized(); |
88 | } | 88 | } |
89 | 89 | ||
90 | void OIpkgConfigDlg::accept() | 90 | void OIpkgConfigDlg::accept() |
91 | { | 91 | { |
92 | // Save server, destination and proxy configuration | 92 | // Save server, destination and proxy configuration |
93 | if ( !m_installOptions ) | 93 | if ( !m_installOptions ) |
94 | { | ||
95 | // Update proxy information before saving settings | ||
96 | OConfItem *confItem = findConfItem( OConfItem::Option, "http_proxy" ); | ||
97 | if ( confItem ) | ||
98 | { | ||
99 | confItem->setValue( m_proxyHttpServer->text() ); | ||
100 | confItem->setActive( m_proxyHttpActive->isChecked() ); | ||
101 | } | ||
102 | else | ||
103 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "http_proxy", | ||
104 | m_proxyHttpServer->text(), m_proxyHttpActive->isChecked() ) ); | ||
105 | |||
106 | confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); | ||
107 | if ( confItem ) | ||
108 | { | ||
109 | confItem->setValue( m_proxyFtpServer->text() ); | ||
110 | confItem->setActive( m_proxyFtpActive->isChecked() ); | ||
111 | } | ||
112 | else | ||
113 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "ftp_proxy", | ||
114 | m_proxyFtpServer->text(), m_proxyFtpActive->isChecked() ) ); | ||
115 | |||
116 | confItem = findConfItem( OConfItem::Option, "proxy_username" ); | ||
117 | if ( confItem ) | ||
118 | confItem->setValue( m_proxyUsername->text() ); | ||
119 | else | ||
120 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "proxy_username", | ||
121 | m_proxyUsername->text() ) ); | ||
122 | |||
123 | confItem = findConfItem( OConfItem::Option, "proxy_password" ); | ||
124 | if ( confItem ) | ||
125 | confItem->setValue( m_proxyPassword->text() ); | ||
126 | else | ||
127 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "proxy_password", | ||
128 | m_proxyPassword->text() ) ); | ||
129 | |||
94 | m_ipkg->setConfigItems( m_configs ); | 130 | m_ipkg->setConfigItems( m_configs ); |
131 | } | ||
95 | 132 | ||
96 | // Save options configuration | 133 | // Save options configuration |
97 | int options = 0; | 134 | int options = 0; |
98 | if ( m_optForceDepends->isChecked() ) | 135 | if ( m_optForceDepends->isChecked() ) |
99 | options |= FORCE_DEPENDS; | 136 | options |= FORCE_DEPENDS; |
100 | if ( m_optForceReinstall->isChecked() ) | 137 | if ( m_optForceReinstall->isChecked() ) |
101 | options |= FORCE_REINSTALL; | 138 | options |= FORCE_REINSTALL; |
102 | if ( m_optForceRemove->isChecked() ) | 139 | if ( m_optForceRemove->isChecked() ) |
103 | options |= FORCE_REMOVE; | 140 | options |= FORCE_REMOVE; |
104 | if ( m_optForceOverwrite->isChecked() ) | 141 | if ( m_optForceOverwrite->isChecked() ) |
105 | options |= FORCE_OVERWRITE; | 142 | options |= FORCE_OVERWRITE; |
106 | m_ipkg->setIpkgExecOptions( options ); | 143 | m_ipkg->setIpkgExecOptions( options ); |
107 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); | 144 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); |
108 | 145 | ||
109 | QDialog::accept(); | 146 | QDialog::accept(); |
110 | } | 147 | } |
111 | 148 | ||
112 | void OIpkgConfigDlg::reject() | 149 | void OIpkgConfigDlg::reject() |
113 | { | 150 | { |
114 | if ( m_configs ) | 151 | if ( m_configs ) |
115 | delete m_configs; | 152 | delete m_configs; |
116 | } | 153 | } |
117 | 154 | ||
118 | void OIpkgConfigDlg::initServerWidget() | 155 | void OIpkgConfigDlg::initServerWidget() |
119 | { | 156 | { |
120 | m_serverWidget = new QWidget( this ); | 157 | m_serverWidget = new QWidget( this ); |
121 | 158 | ||
122 | // Initialize UI | 159 | // Initialize UI |
123 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); | 160 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); |
124 | QScrollView *sv = new QScrollView( m_serverWidget ); | 161 | QScrollView *sv = new QScrollView( m_serverWidget ); |
125 | vb->addWidget( sv, 0, 0 ); | 162 | vb->addWidget( sv, 0, 0 ); |
126 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 163 | sv->setResizePolicy( QScrollView::AutoOneFit ); |