summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg
authorandyq <andyq>2002-12-12 00:18:40 (UTC)
committer andyq <andyq>2002-12-12 00:18:40 (UTC)
commit1d044ba4d276240b60bc98d18365a80183960751 (patch) (unidiff)
tree98f69f03bb7ff4a904c02322be6480c54b6a7e08 /noncore/settings/aqpkg
parentfe063bdf069cd33def6347777624798e4f3a7059 (diff)
downloadopie-1d044ba4d276240b60bc98d18365a80183960751.zip
opie-1d044ba4d276240b60bc98d18365a80183960751.tar.gz
opie-1d044ba4d276240b60bc98d18365a80183960751.tar.bz2
Added proxy support
Diffstat (limited to 'noncore/settings/aqpkg') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp28
-rw-r--r--noncore/settings/aqpkg/datamgr.h18
-rw-r--r--noncore/settings/aqpkg/settings.ui245
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp21
-rw-r--r--noncore/settings/aqpkg/settingsimpl.h2
5 files changed, 298 insertions, 16 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp
index 96c28c0..3933a22 100644
--- a/noncore/settings/aqpkg/datamgr.cpp
+++ b/noncore/settings/aqpkg/datamgr.cpp
@@ -130,15 +130,27 @@ void DataManager :: loadServers()
130 130
131 destList.push_back( d ); 131 destList.push_back( d );
132 } 132 }
133 else if ( lineStr.startsWith( "option" ) ) 133 else if ( lineStr.startsWith( "option" ) || lineStr.startsWith( "#option" ) )
134 { 134 {
135 char type[20]; 135 char type[20];
136 char val[100]; 136 char val[100];
137 sscanf( lineStr, "%*[^ ] %s %s", type, val ); 137 sscanf( lineStr, "%*[^ ] %s %s", type, val );
138 if ( stricmp( type, "http_proxy" ) == 0 ) 138 if ( stricmp( type, "http_proxy" ) == 0 )
139 {
139 httpProxy = val; 140 httpProxy = val;
141 if ( lineStr.startsWith( "#" ) )
142 httpProxyEnabled = false;
143 else
144 httpProxyEnabled = true;
145 }
140 if ( stricmp( type, "ftp_proxy" ) == 0 ) 146 if ( stricmp( type, "ftp_proxy" ) == 0 )
147 {
141 ftpProxy = val; 148 ftpProxy = val;
149 if ( lineStr.startsWith( "#" ) )
150 ftpProxyEnabled = false;
151 else
152 ftpProxyEnabled = true;
153 }
142 if ( stricmp( type, "proxy_username" ) == 0 ) 154 if ( stricmp( type, "proxy_username" ) == 0 )
143 proxyUsername = val; 155 proxyUsername = val;
144 if ( stricmp( type, "proxy_password" ) == 0 ) 156 if ( stricmp( type, "proxy_password" ) == 0 )
@@ -218,18 +230,26 @@ void DataManager :: writeOutIpkgConf()
218 it2++; 230 it2++;
219 } 231 }
220 232
233 out << endl;
221 out << "# Proxy Support" << endl; 234 out << "# Proxy Support" << endl;
222 out << "#" << endl;
223 235
224 if ( httpProxy == "" ) 236 if ( !httpProxyEnabled && httpProxy == "" )
225 out << "#option http_proxy http://proxy.tld:3128" << endl; 237 out << "#option http_proxy http://proxy.tld:3128" << endl;
226 else 238 else
239 {
240 if ( !httpProxyEnabled )
241 out << "#";
227 out << "option http_proxy " << httpProxy << endl; 242 out << "option http_proxy " << httpProxy << endl;
243 }
228 244
229 if ( ftpProxy == "" ) 245 if ( !ftpProxyEnabled && ftpProxy == "" )
230 out << "#option ftp_proxy http://proxy.tld:3128" << endl; 246 out << "#option ftp_proxy http://proxy.tld:3128" << endl;
231 else 247 else
248 {
249 if ( !ftpProxyEnabled )
250 out << "#";
232 out << "option ftp_proxy " << ftpProxy << endl; 251 out << "option ftp_proxy " << ftpProxy << endl;
252 }
233 if ( proxyUsername == "" ) 253 if ( proxyUsername == "" )
234 out << "#option proxy_username <username>" << endl; 254 out << "#option proxy_username <username>" << endl;
235 else 255 else
diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h
index 41833df..0a7467f 100644
--- a/noncore/settings/aqpkg/datamgr.h
+++ b/noncore/settings/aqpkg/datamgr.h
@@ -58,6 +58,21 @@ public:
58 static QString getAvailableCategories() { return availableCategories; } 58 static QString getAvailableCategories() { return availableCategories; }
59 static void setAvailableCategories( QString section ); 59 static void setAvailableCategories( QString section );
60 60
61 QString getHttpProxy() { return httpProxy; }
62 QString getFtpProxy() { return ftpProxy; }
63 QString getProxyUsername() { return proxyUsername; }
64 QString getProxyPassword() { return proxyPassword; }
65
66 bool getHttpProxyEnabled() { return httpProxyEnabled; }
67 bool getFtpProxyEnabled() { return ftpProxyEnabled; }
68
69 void setHttpProxy( QString proxy ) { httpProxy = proxy; }
70 void setFtpProxy( QString proxy ) { ftpProxy = proxy; }
71 void setProxyUsername( QString name ) { proxyUsername = name; }
72 void setProxyPassword( QString pword ) { proxyPassword = pword; }
73
74 void setHttpProxyEnabled( bool val ) { httpProxyEnabled = val; }
75 void setFtpProxyEnabled( bool val ) { ftpProxyEnabled = val; }
61private: 76private:
62 static QString availableCategories; 77 static QString availableCategories;
63 QString activeServer; 78 QString activeServer;
@@ -66,6 +81,9 @@ private:
66 QString proxyUsername; 81 QString proxyUsername;
67 QString proxyPassword; 82 QString proxyPassword;
68 83
84 bool httpProxyEnabled;
85 bool ftpProxyEnabled;
86
69 vector<Server> serverList; 87 vector<Server> serverList;
70 vector<Destination> destList; 88 vector<Destination> destList;
71}; 89};
diff --git a/noncore/settings/aqpkg/settings.ui b/noncore/settings/aqpkg/settings.ui
index 44e8fd9..b39d358 100644
--- a/noncore/settings/aqpkg/settings.ui
+++ b/noncore/settings/aqpkg/settings.ui
@@ -11,7 +11,7 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>235</width> 14 <width>211</width>
15 <height>390</height> 15 <height>390</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
@@ -25,16 +25,7 @@
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
27 </property> 27 </property>
28 <grid> 28 <widget>
29 <property stdset="1">
30 <name>margin</name>
31 <number>11</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>6</number>
36 </property>
37 <widget row="0" column="0" >
38 <class>QTabWidget</class> 29 <class>QTabWidget</class>
39 <property stdset="1"> 30 <property stdset="1">
40 <name>name</name> 31 <name>name</name>
@@ -44,6 +35,15 @@
44 <name>enabled</name> 35 <name>enabled</name>
45 <bool>true</bool> 36 <bool>true</bool>
46 </property> 37 </property>
38 <property stdset="1">
39 <name>geometry</name>
40 <rect>
41 <x>11</x>
42 <y>11</y>
43 <width>209</width>
44 <height>368</height>
45 </rect>
46 </property>
47 <property> 47 <property>
48 <name>layoutMargin</name> 48 <name>layoutMargin</name>
49 </property> 49 </property>
@@ -505,6 +505,221 @@
505 </property> 505 </property>
506 <attribute> 506 <attribute>
507 <name>title</name> 507 <name>title</name>
508 <string>Proxys</string>
509 </attribute>
510 <widget>
511 <class>QLabel</class>
512 <property stdset="1">
513 <name>name</name>
514 <cstring>TextLabel1_2</cstring>
515 </property>
516 <property stdset="1">
517 <name>geometry</name>
518 <rect>
519 <x>1</x>
520 <y>19</y>
521 <width>67</width>
522 <height>22</height>
523 </rect>
524 </property>
525 <property stdset="1">
526 <name>text</name>
527 <string>HTTP Proxy</string>
528 </property>
529 </widget>
530 <widget>
531 <class>QLineEdit</class>
532 <property stdset="1">
533 <name>name</name>
534 <cstring>txtFtpProxy</cstring>
535 </property>
536 <property stdset="1">
537 <name>geometry</name>
538 <rect>
539 <x>74</x>
540 <y>72</y>
541 <width>110</width>
542 <height>22</height>
543 </rect>
544 </property>
545 </widget>
546 <widget>
547 <class>QLineEdit</class>
548 <property stdset="1">
549 <name>name</name>
550 <cstring>txtHttpProxy</cstring>
551 </property>
552 <property stdset="1">
553 <name>geometry</name>
554 <rect>
555 <x>74</x>
556 <y>19</y>
557 <width>110</width>
558 <height>22</height>
559 </rect>
560 </property>
561 </widget>
562 <widget>
563 <class>QLabel</class>
564 <property stdset="1">
565 <name>name</name>
566 <cstring>TextLabel4</cstring>
567 </property>
568 <property stdset="1">
569 <name>geometry</name>
570 <rect>
571 <x>1</x>
572 <y>153</y>
573 <width>67</width>
574 <height>22</height>
575 </rect>
576 </property>
577 <property stdset="1">
578 <name>text</name>
579 <string>Password</string>
580 </property>
581 </widget>
582 <widget>
583 <class>QLineEdit</class>
584 <property stdset="1">
585 <name>name</name>
586 <cstring>txtUsername</cstring>
587 </property>
588 <property stdset="1">
589 <name>geometry</name>
590 <rect>
591 <x>74</x>
592 <y>125</y>
593 <width>110</width>
594 <height>22</height>
595 </rect>
596 </property>
597 </widget>
598 <widget>
599 <class>QLineEdit</class>
600 <property stdset="1">
601 <name>name</name>
602 <cstring>txtPassword</cstring>
603 </property>
604 <property stdset="1">
605 <name>geometry</name>
606 <rect>
607 <x>74</x>
608 <y>153</y>
609 <width>110</width>
610 <height>22</height>
611 </rect>
612 </property>
613 </widget>
614 <widget>
615 <class>QCheckBox</class>
616 <property stdset="1">
617 <name>name</name>
618 <cstring>chkFtpProxyEnabled</cstring>
619 </property>
620 <property stdset="1">
621 <name>geometry</name>
622 <rect>
623 <x>74</x>
624 <y>100</y>
625 <width>110</width>
626 <height>19</height>
627 </rect>
628 </property>
629 <property stdset="1">
630 <name>text</name>
631 <string>Enabled</string>
632 </property>
633 </widget>
634 <widget>
635 <class>QLabel</class>
636 <property stdset="1">
637 <name>name</name>
638 <cstring>TextLabel2</cstring>
639 </property>
640 <property stdset="1">
641 <name>geometry</name>
642 <rect>
643 <x>1</x>
644 <y>72</y>
645 <width>67</width>
646 <height>22</height>
647 </rect>
648 </property>
649 <property stdset="1">
650 <name>text</name>
651 <string>FTP Proxy</string>
652 </property>
653 </widget>
654 <widget>
655 <class>QLabel</class>
656 <property stdset="1">
657 <name>name</name>
658 <cstring>TextLabel3</cstring>
659 </property>
660 <property stdset="1">
661 <name>geometry</name>
662 <rect>
663 <x>1</x>
664 <y>125</y>
665 <width>67</width>
666 <height>22</height>
667 </rect>
668 </property>
669 <property stdset="1">
670 <name>text</name>
671 <string>Username</string>
672 </property>
673 </widget>
674 <widget>
675 <class>QCheckBox</class>
676 <property stdset="1">
677 <name>name</name>
678 <cstring>chkHttpProxyEnabled</cstring>
679 </property>
680 <property stdset="1">
681 <name>geometry</name>
682 <rect>
683 <x>74</x>
684 <y>47</y>
685 <width>110</width>
686 <height>19</height>
687 </rect>
688 </property>
689 <property stdset="1">
690 <name>text</name>
691 <string>Enabled</string>
692 </property>
693 </widget>
694 <widget>
695 <class>QPushButton</class>
696 <property stdset="1">
697 <name>name</name>
698 <cstring>btnProxyApply</cstring>
699 </property>
700 <property stdset="1">
701 <name>geometry</name>
702 <rect>
703 <x>74</x>
704 <y>181</y>
705 <width>110</width>
706 <height>28</height>
707 </rect>
708 </property>
709 <property stdset="1">
710 <name>text</name>
711 <string>&amp;Apply</string>
712 </property>
713 </widget>
714 </widget>
715 <widget>
716 <class>QWidget</class>
717 <property stdset="1">
718 <name>name</name>
719 <cstring>tab</cstring>
720 </property>
721 <attribute>
722 <name>title</name>
508 <string>General</string> 723 <string>General</string>
509 </attribute> 724 </attribute>
510 <widget> 725 <widget>
@@ -549,7 +764,6 @@
549 </widget> 764 </widget>
550 </widget> 765 </widget>
551 </widget> 766 </widget>
552 </grid>
553</widget> 767</widget>
554<connections> 768<connections>
555 <connection> 769 <connection>
@@ -606,6 +820,12 @@
606 <receiver>Settings</receiver> 820 <receiver>Settings</receiver>
607 <slot>toggleJumpTo(bool)</slot> 821 <slot>toggleJumpTo(bool)</slot>
608 </connection> 822 </connection>
823 <connection>
824 <sender>btnProxyApply</sender>
825 <signal>clicked()</signal>
826 <receiver>Settings</receiver>
827 <slot>proxyApplyChanges()</slot>
828 </connection>
609 <slot access="public">activeServerChanged()</slot> 829 <slot access="public">activeServerChanged()</slot>
610 <slot access="public">changeDestinationDetails()</slot> 830 <slot access="public">changeDestinationDetails()</slot>
611 <slot access="public">changeServerDetails()</slot> 831 <slot access="public">changeServerDetails()</slot>
@@ -620,6 +840,7 @@
620 <slot access="public">newDestination()</slot> 840 <slot access="public">newDestination()</slot>
621 <slot access="public">newInstallationSetting()</slot> 841 <slot access="public">newInstallationSetting()</slot>
622 <slot access="public">newServer()</slot> 842 <slot access="public">newServer()</slot>
843 <slot access="public">proxyApplyChanges()</slot>
623 <slot access="public">removeDestination()</slot> 844 <slot access="public">removeDestination()</slot>
624 <slot access="public">removeInstallationSetting()</slot> 845 <slot access="public">removeInstallationSetting()</slot>
625 <slot access="public">removeLinksToDest()</slot> 846 <slot access="public">removeLinksToDest()</slot>
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index 9dd2206..4bb928a 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -78,6 +78,7 @@ void SettingsImpl :: setupData()
78 for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 ) 78 for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 )
79 destinations->insertItem( it2->getDestinationName() ); 79 destinations->insertItem( it2->getDestinationName() );
80 80
81 // setup general tab
81#ifdef QWS 82#ifdef QWS
82 Config cfg( "aqpkg" ); 83 Config cfg( "aqpkg" );
83 cfg.setGroup( "settings" ); 84 cfg.setGroup( "settings" );
@@ -85,6 +86,14 @@ void SettingsImpl :: setupData()
85#else 86#else
86 jumpTo->setChecked( true ); 87 jumpTo->setChecked( true );
87#endif 88#endif
89
90 // setup proxy tab
91 txtHttpProxy->setText( dataMgr->getHttpProxy() );
92 txtFtpProxy->setText( dataMgr->getFtpProxy() );
93 txtUsername->setText( dataMgr->getProxyUsername() );
94 txtPassword->setText( dataMgr->getProxyPassword() );
95 chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() );
96 chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() );
88} 97}
89 98
90//------------------ Servers tab ---------------------- 99//------------------ Servers tab ----------------------
@@ -244,3 +253,15 @@ void SettingsImpl :: toggleJumpTo( bool val )
244#endif 253#endif
245} 254}
246 255
256//------------------ Proxy tab ----------------------
257void SettingsImpl :: proxyApplyChanges()
258{
259 changed = true;
260 dataMgr->setHttpProxy( txtHttpProxy->text() );
261 dataMgr->setFtpProxy( txtFtpProxy->text() );
262 dataMgr->setProxyUsername( txtUsername->text() );
263 dataMgr->setProxyPassword( txtPassword->text() );
264
265 dataMgr->setHttpProxyEnabled( chkHttpProxyEnabled->isChecked() );
266 dataMgr->setFtpProxyEnabled( chkFtpProxyEnabled->isChecked() );
267}
diff --git a/noncore/settings/aqpkg/settingsimpl.h b/noncore/settings/aqpkg/settingsimpl.h
index 971516b..bb027dc 100644
--- a/noncore/settings/aqpkg/settingsimpl.h
+++ b/noncore/settings/aqpkg/settingsimpl.h
@@ -51,4 +51,6 @@ private:
51 void removeDestination(); 51 void removeDestination();
52 52
53 void toggleJumpTo( bool val ); 53 void toggleJumpTo( bool val );
54
55 void proxyApplyChanges();
54}; 56};