summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-09-25 15:02:43 (UTC)
committer mickeyl <mickeyl>2003-09-25 15:02:43 (UTC)
commit9047b6d4ffe0cbcecd90fd994ce2353277c378a1 (patch) (unidiff)
treec649c9c85c9c5846c0019e26bb3aaafbfbc76757
parent990e3c5834b33227b327e1fec0d7f7f429e75952 (diff)
downloadopie-9047b6d4ffe0cbcecd90fd994ce2353277c378a1.zip
opie-9047b6d4ffe0cbcecd90fd994ce2353277c378a1.tar.gz
opie-9047b6d4ffe0cbcecd90fd994ce2353277c378a1.tar.bz2
start with persistent configuration
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configbase.ui107
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp67
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.h5
3 files changed, 113 insertions, 66 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui
index d9a0aea..d7ab3bb 100644
--- a/noncore/net/wellenreiter/gui/configbase.ui
+++ b/noncore/net/wellenreiter/gui/configbase.ui
@@ -1,79 +1,79 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>WellenreiterConfigBase</class> 2<class>WellenreiterConfigBase</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>WellenreiterConfigBase</cstring> 7 <cstring>WellenreiterConfigBase</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>286</width> 14 <width>303</width>
15 <height>280</height> 15 <height>287</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Wellenreiter II COnfiguration Dialog</string> 20 <string>Wellenreiter II COnfiguration Dialog</string>
21 </property> 21 </property>
22 <property> 22 <property>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
27 </property> 27 </property>
28 <grid> 28 <grid>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>2</number> 31 <number>2</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>3</number> 35 <number>3</number>
36 </property> 36 </property>
37 <widget row="0" column="0" > 37 <widget row="0" column="0" >
38 <class>QTabWidget</class> 38 <class>QTabWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>tab</cstring> 41 <cstring>tab</cstring>
42 </property> 42 </property>
43 <property> 43 <property>
44 <name>layoutMargin</name> 44 <name>layoutMargin</name>
45 </property> 45 </property>
46 <property> 46 <property>
47 <name>layoutSpacing</name> 47 <name>layoutSpacing</name>
48 </property> 48 </property>
49 <widget> 49 <widget>
50 <class>QWidget</class> 50 <class>QWidget</class>
51 <property stdset="1"> 51 <property stdset="1">
52 <name>name</name> 52 <name>name</name>
53 <cstring>tab</cstring> 53 <cstring>tab</cstring>
54 </property> 54 </property>
55 <attribute> 55 <attribute>
56 <name>title</name> 56 <name>title</name>
57 <string>Interface</string> 57 <string>Interface</string>
58 </attribute> 58 </attribute>
59 <grid> 59 <grid>
60 <property stdset="1"> 60 <property stdset="1">
61 <name>margin</name> 61 <name>margin</name>
62 <number>5</number> 62 <number>5</number>
63 </property> 63 </property>
64 <property stdset="1"> 64 <property stdset="1">
65 <name>spacing</name> 65 <name>spacing</name>
66 <number>3</number> 66 <number>3</number>
67 </property> 67 </property>
68 <widget row="0" column="0" > 68 <widget row="0" column="0" >
69 <class>QLabel</class> 69 <class>QLabel</class>
70 <property stdset="1"> 70 <property stdset="1">
71 <name>name</name> 71 <name>name</name>
72 <cstring>TextLabel1_2</cstring> 72 <cstring>TextLabel1_2</cstring>
73 </property> 73 </property>
74 <property stdset="1"> 74 <property stdset="1">
75 <name>enabled</name> 75 <name>enabled</name>
76 <bool>true</bool> 76 <bool>true</bool>
77 </property> 77 </property>
78 <property stdset="1"> 78 <property stdset="1">
79 <name>text</name> 79 <name>text</name>
@@ -566,256 +566,267 @@
566 </property> 566 </property>
567 </spacer> 567 </spacer>
568 <widget row="0" column="0" > 568 <widget row="0" column="0" >
569 <class>QCheckBox</class> 569 <class>QCheckBox</class>
570 <property stdset="1"> 570 <property stdset="1">
571 <name>name</name> 571 <name>name</name>
572 <cstring>writeCaptureFile</cstring> 572 <cstring>writeCaptureFile</cstring>
573 </property> 573 </property>
574 <property stdset="1"> 574 <property stdset="1">
575 <name>enabled</name> 575 <name>enabled</name>
576 <bool>true</bool> 576 <bool>true</bool>
577 </property> 577 </property>
578 <property stdset="1"> 578 <property stdset="1">
579 <name>text</name> 579 <name>text</name>
580 <string>Write Capture Files To</string> 580 <string>Write Capture Files To</string>
581 </property> 581 </property>
582 </widget> 582 </widget>
583 </grid> 583 </grid>
584 </widget> 584 </widget>
585 <widget> 585 <widget>
586 <class>QWidget</class> 586 <class>QWidget</class>
587 <property stdset="1"> 587 <property stdset="1">
588 <name>name</name> 588 <name>name</name>
589 <cstring>tab</cstring> 589 <cstring>tab</cstring>
590 </property> 590 </property>
591 <attribute> 591 <attribute>
592 <name>title</name> 592 <name>title</name>
593 <string>Parse</string> 593 <string>Parse</string>
594 </attribute> 594 </attribute>
595 <grid> 595 <grid>
596 <property stdset="1"> 596 <property stdset="1">
597 <name>margin</name> 597 <name>margin</name>
598 <number>5</number> 598 <number>5</number>
599 </property> 599 </property>
600 <property stdset="1"> 600 <property stdset="1">
601 <name>spacing</name> 601 <name>spacing</name>
602 <number>3</number> 602 <number>3</number>
603 </property> 603 </property>
604 <widget row="0" column="0" > 604 <widget row="0" column="0" >
605 <class>ProtocolListView</class> 605 <class>ProtocolListView</class>
606 <property stdset="1"> 606 <property stdset="1">
607 <name>name</name> 607 <name>name</name>
608 <cstring>parsePackets</cstring> 608 <cstring>parsePackets</cstring>
609 </property> 609 </property>
610 <property stdset="1"> 610 <property stdset="1">
611 <name>sizePolicy</name> 611 <name>sizePolicy</name>
612 <sizepolicy> 612 <sizepolicy>
613 <hsizetype>7</hsizetype> 613 <hsizetype>7</hsizetype>
614 <vsizetype>7</vsizetype> 614 <vsizetype>7</vsizetype>
615 </sizepolicy> 615 </sizepolicy>
616 </property> 616 </property>
617 </widget> 617 </widget>
618 </grid> 618 </grid>
619 </widget> 619 </widget>
620 <widget> 620 <widget>
621 <class>QWidget</class> 621 <class>QWidget</class>
622 <property stdset="1"> 622 <property stdset="1">
623 <name>name</name> 623 <name>name</name>
624 <cstring>tab</cstring> 624 <cstring>tab</cstring>
625 </property> 625 </property>
626 <attribute> 626 <attribute>
627 <name>title</name> 627 <name>title</name>
628 <string>UI</string> 628 <string>UI</string>
629 </attribute> 629 </attribute>
630 <grid> 630 <vbox>
631 <property stdset="1"> 631 <property stdset="1">
632 <name>margin</name> 632 <name>margin</name>
633 <number>11</number> 633 <number>11</number>
634 </property> 634 </property>
635 <property stdset="1"> 635 <property stdset="1">
636 <name>spacing</name> 636 <name>spacing</name>
637 <number>6</number> 637 <number>6</number>
638 </property> 638 </property>
639 <widget row="3" column="0" > 639 <widget>
640 <class>QCheckBox</class>
641 <property stdset="1">
642 <name>name</name>
643 <cstring>lookupVendor</cstring>
644 </property>
645 <property stdset="1">
646 <name>text</name>
647 <string>Lookup MAC vendor names</string>
648 </property>
649 </widget>
650 <widget>
651 <class>QCheckBox</class>
652 <property stdset="1">
653 <name>name</name>
654 <cstring>openTree</cstring>
655 </property>
656 <property stdset="1">
657 <name>text</name>
658 <string>Open Tree On New Station</string>
659 </property>
660 </widget>
661 <widget>
662 <class>QCheckBox</class>
663 <property stdset="1">
664 <name>name</name>
665 <cstring>disablePM</cstring>
666 </property>
667 <property stdset="1">
668 <name>text</name>
669 <string>Disable Power Management</string>
670 </property>
671 </widget>
672 <spacer>
673 <property>
674 <name>name</name>
675 <cstring>Spacer3</cstring>
676 </property>
677 <property stdset="1">
678 <name>orientation</name>
679 <enum>Vertical</enum>
680 </property>
681 <property stdset="1">
682 <name>sizeType</name>
683 <enum>Expanding</enum>
684 </property>
685 <property>
686 <name>sizeHint</name>
687 <size>
688 <width>20</width>
689 <height>20</height>
690 </size>
691 </property>
692 </spacer>
693 <widget>
640 <class>QGroupBox</class> 694 <class>QGroupBox</class>
641 <property stdset="1"> 695 <property stdset="1">
642 <name>name</name> 696 <name>name</name>
643 <cstring>GroupBox4_2</cstring> 697 <cstring>GroupBox4_2</cstring>
644 </property> 698 </property>
645 <property stdset="1"> 699 <property stdset="1">
646 <name>title</name> 700 <name>title</name>
647 <string>Action On Detecting</string> 701 <string>Action On Detecting</string>
648 </property> 702 </property>
649 <grid> 703 <grid>
650 <property stdset="1"> 704 <property stdset="1">
651 <name>margin</name> 705 <name>margin</name>
652 <number>11</number> 706 <number>11</number>
653 </property> 707 </property>
654 <property stdset="1"> 708 <property stdset="1">
655 <name>spacing</name> 709 <name>spacing</name>
656 <number>6</number> 710 <number>6</number>
657 </property> 711 </property>
658 <widget row="1" column="0" > 712 <widget row="1" column="0" >
659 <class>QLabel</class> 713 <class>QLabel</class>
660 <property stdset="1"> 714 <property stdset="1">
661 <name>name</name> 715 <name>name</name>
662 <cstring>TextLabel2</cstring> 716 <cstring>TextLabel2</cstring>
663 </property> 717 </property>
664 <property stdset="1"> 718 <property stdset="1">
665 <name>text</name> 719 <name>text</name>
666 <string>New Wireless Station</string> 720 <string>New Wireless Station</string>
667 </property> 721 </property>
668 </widget> 722 </widget>
669 <widget row="0" column="0" > 723 <widget row="0" column="0" >
670 <class>QLabel</class> 724 <class>QLabel</class>
671 <property stdset="1"> 725 <property stdset="1">
672 <name>name</name> 726 <name>name</name>
673 <cstring>TextLabel1_3</cstring> 727 <cstring>TextLabel1_3</cstring>
674 </property> 728 </property>
675 <property stdset="1"> 729 <property stdset="1">
676 <name>text</name> 730 <name>text</name>
677 <string>New Network</string> 731 <string>New Network</string>
678 </property> 732 </property>
679 </widget> 733 </widget>
680 <widget row="0" column="1" > 734 <widget row="0" column="1" >
681 <class>QComboBox</class> 735 <class>QComboBox</class>
682 <property stdset="1"> 736 <property stdset="1">
683 <name>name</name> 737 <name>name</name>
684 <cstring>newNetwork</cstring> 738 <cstring>newNetwork</cstring>
685 </property> 739 </property>
686 </widget> 740 </widget>
687 <widget row="1" column="1" > 741 <widget row="1" column="1" >
688 <class>QComboBox</class> 742 <class>QComboBox</class>
689 <property stdset="1"> 743 <property stdset="1">
690 <name>name</name> 744 <name>name</name>
691 <cstring>newWirelessStation</cstring> 745 <cstring>newWirelessStation</cstring>
692 </property> 746 </property>
693 </widget> 747 </widget>
694 <widget row="2" column="1" > 748 <widget row="2" column="1" >
695 <class>QComboBox</class> 749 <class>QComboBox</class>
696 <property stdset="1"> 750 <property stdset="1">
697 <name>name</name> 751 <name>name</name>
698 <cstring>newStation</cstring> 752 <cstring>newStation</cstring>
699 </property> 753 </property>
700 </widget> 754 </widget>
701 <widget row="2" column="0" > 755 <widget row="2" column="0" >
702 <class>QLabel</class> 756 <class>QLabel</class>
703 <property stdset="1"> 757 <property stdset="1">
704 <name>name</name> 758 <name>name</name>
705 <cstring>TextLabel3</cstring> 759 <cstring>TextLabel3</cstring>
706 </property> 760 </property>
707 <property stdset="1"> 761 <property stdset="1">
708 <name>text</name> 762 <name>text</name>
709 <string>New Station</string> 763 <string>New Station</string>
710 </property> 764 </property>
711 </widget> 765 </widget>
712 </grid> 766 </grid>
713 </widget> 767 </widget>
714 <spacer row="2" column="0" > 768 </vbox>
715 <property>
716 <name>name</name>
717 <cstring>Spacer3</cstring>
718 </property>
719 <property stdset="1">
720 <name>orientation</name>
721 <enum>Vertical</enum>
722 </property>
723 <property stdset="1">
724 <name>sizeType</name>
725 <enum>Expanding</enum>
726 </property>
727 <property>
728 <name>sizeHint</name>
729 <size>
730 <width>20</width>
731 <height>20</height>
732 </size>
733 </property>
734 </spacer>
735 <widget row="0" column="0" >
736 <class>QCheckBox</class>
737 <property stdset="1">
738 <name>name</name>
739 <cstring>lookupVendor</cstring>
740 </property>
741 <property stdset="1">
742 <name>text</name>
743 <string>Lookup MAC vendor names</string>
744 </property>
745 </widget>
746 <widget row="1" column="0" >
747 <class>QCheckBox</class>
748 <property stdset="1">
749 <name>name</name>
750 <cstring>openTree</cstring>
751 </property>
752 <property stdset="1">
753 <name>text</name>
754 <string>Open Tree On New Station</string>
755 </property>
756 </widget>
757 </grid>
758 </widget> 769 </widget>
759 <widget> 770 <widget>
760 <class>QWidget</class> 771 <class>QWidget</class>
761 <property stdset="1"> 772 <property stdset="1">
762 <name>name</name> 773 <name>name</name>
763 <cstring>tab</cstring> 774 <cstring>tab</cstring>
764 </property> 775 </property>
765 <attribute> 776 <attribute>
766 <name>title</name> 777 <name>title</name>
767 <string>Intrusion</string> 778 <string>Intrusion</string>
768 </attribute> 779 </attribute>
769 <grid> 780 <grid>
770 <property stdset="1"> 781 <property stdset="1">
771 <name>margin</name> 782 <name>margin</name>
772 <number>11</number> 783 <number>11</number>
773 </property> 784 </property>
774 <property stdset="1"> 785 <property stdset="1">
775 <name>spacing</name> 786 <name>spacing</name>
776 <number>6</number> 787 <number>6</number>
777 </property> 788 </property>
778 <widget row="1" column="0" > 789 <widget row="1" column="0" >
779 <class>QGroupBox</class> 790 <class>QGroupBox</class>
780 <property stdset="1"> 791 <property stdset="1">
781 <name>name</name> 792 <name>name</name>
782 <cstring>GroupBox3</cstring> 793 <cstring>GroupBox3</cstring>
783 </property> 794 </property>
784 <property stdset="1"> 795 <property stdset="1">
785 <name>enabled</name> 796 <name>enabled</name>
786 <bool>false</bool> 797 <bool>false</bool>
787 </property> 798 </property>
788 <property stdset="1"> 799 <property stdset="1">
789 <name>title</name> 800 <name>title</name>
790 <string>Link Level</string> 801 <string>Link Level</string>
791 </property> 802 </property>
792 <grid> 803 <grid>
793 <property stdset="1"> 804 <property stdset="1">
794 <name>margin</name> 805 <name>margin</name>
795 <number>11</number> 806 <number>11</number>
796 </property> 807 </property>
797 <property stdset="1"> 808 <property stdset="1">
798 <name>spacing</name> 809 <name>spacing</name>
799 <number>6</number> 810 <number>6</number>
800 </property> 811 </property>
801 <widget row="0" column="0" > 812 <widget row="0" column="0" >
802 <class>QLabel</class> 813 <class>QLabel</class>
803 <property stdset="1"> 814 <property stdset="1">
804 <name>name</name> 815 <name>name</name>
805 <cstring>TextLabel1_5</cstring> 816 <cstring>TextLabel1_5</cstring>
806 </property> 817 </property>
807 <property stdset="1"> 818 <property stdset="1">
808 <name>text</name> 819 <name>text</name>
809 <string>Fake Mac:</string> 820 <string>Fake Mac:</string>
810 </property> 821 </property>
811 </widget> 822 </widget>
812 <widget row="1" column="0" rowspan="1" colspan="2" > 823 <widget row="1" column="0" rowspan="1" colspan="2" >
813 <class>QCheckBox</class> 824 <class>QCheckBox</class>
814 <property stdset="1"> 825 <property stdset="1">
815 <name>name</name> 826 <name>name</name>
816 <cstring>sendProbeRequests</cstring> 827 <cstring>sendProbeRequests</cstring>
817 </property> 828 </property>
818 <property stdset="1"> 829 <property stdset="1">
819 <name>text</name> 830 <name>text</name>
820 <string>Send proble requests</string> 831 <string>Send proble requests</string>
821 </property> 832 </property>
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index a331925..d255c6a 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -1,210 +1,241 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16/* LOCAL */ 16/* LOCAL */
17#include "configwindow.h" 17#include "configwindow.h"
18#include "mainwindow.h" 18#include "mainwindow.h"
19 19
20/* QT */ 20/* QT */
21#include <qapplication.h> 21#include <qapplication.h>
22#include <qcheckbox.h> 22#include <qcheckbox.h>
23#include <qcombobox.h> 23#include <qcombobox.h>
24#include <qfile.h> 24#include <qfile.h>
25#include <qlineedit.h> 25#include <qlineedit.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qmap.h> 27#include <qmap.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qtoolbutton.h> 29#include <qtoolbutton.h>
30#include <qspinbox.h> 30#include <qspinbox.h>
31#include <qtextstream.h> 31#include <qtextstream.h>
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/onetwork.h> 34#include <opie2/onetwork.h>
35 35
36WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; 36WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
37 37
38WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) 38WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
39 :WellenreiterConfigBase( parent, name, true, f ) 39 :WellenreiterConfigBase( parent, name, true, f )
40{ 40{
41 _devicetype[ "cisco" ] = DEVTYPE_CISCO; 41 _devicetype[ "cisco" ] = DEVTYPE_CISCO;
42 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; 42 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG;
43 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; 43 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP;
44 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; 44 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO;
45 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; 45 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL;
46 _devicetype[ "<file>" ] = DEVTYPE_FILE; 46 _devicetype[ "<file>" ] = DEVTYPE_FILE;
47 47
48 // gather possible interface names from ONetwork 48 // gather possible interface names from ONetwork
49 ONetwork* net = ONetwork::instance(); 49 ONetwork* net = ONetwork::instance();
50 ONetwork::InterfaceIterator it = net->iterator(); 50 ONetwork::InterfaceIterator it = net->iterator();
51 while ( it.current() ) 51 while ( it.current() )
52 { 52 {
53 if ( it.current()->isWireless() ) 53 if ( it.current()->isWireless() )
54 interfaceName->insertItem( it.current()->name() ); 54 interfaceName->insertItem( it.current()->name() );
55 ++it; 55 ++it;
56 } 56 }
57 57
58 // try to guess device type 58 if ( !load() ) // no configuration present
59 QFile m( "/proc/modules" );
60 if ( m.open( IO_ReadOnly ) )
61 { 59 {
62 int devicetype(0); 60 // try to guess device type
63 QString line; 61 QFile m( "/proc/modules" );
64 QTextStream modules( &m ); 62 if ( m.open( IO_ReadOnly ) )
65 while( !modules.atEnd() && !devicetype )
66 { 63 {
67 modules >> line; 64 int devicetype(0);
68 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; 65 QString line;
69 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; 66 QTextStream modules( &m );
70 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; 67 while( !modules.atEnd() && !devicetype )
71 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; 68 {
72 } 69 modules >> line;
73 if ( devicetype ) 70 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO;
74 { 71 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP;
75 deviceType->setCurrentItem( devicetype ); 72 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG;
76 _guess = devicetype; 73 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO;
77 qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); 74 }
75 if ( devicetype )
76 {
77 deviceType->setCurrentItem( devicetype );
78 _guess = devicetype;
79 qDebug( "Wellenreiter: guessed device type to be #%d", devicetype );
80 }
78 } 81 }
79 } 82 }
80 83
81 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here 84 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
82 QPushButton* okButton = new QPushButton( "ok", this ); 85 QPushButton* okButton = new QPushButton( "ok", this );
83 okButton->show(); 86 okButton->show();
84 WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui 87 WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui
85 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); 88 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
86 #endif 89 #endif
87 90
88 WellenreiterConfigWindow::_instance = this; 91 WellenreiterConfigWindow::_instance = this;
89 92
90 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); 93 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
91 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); 94 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
92 95
93 // make the checkbox 'channelAll' control all other channels 96 // make the checkbox 'channelAll' control all other channels
94 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); 97 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) );
95}; 98};
96 99
97 100
101WellenreiterConfigWindow::~WellenreiterConfigWindow()
102{
103 save();
104}
105
106
98int WellenreiterConfigWindow::driverType() const 107int WellenreiterConfigWindow::driverType() const
99{ 108{
100 QString name = deviceType->currentText(); 109 QString name = deviceType->currentText();
101 if ( _devicetype.contains( name ) ) 110 if ( _devicetype.contains( name ) )
102 { 111 {
103 return _devicetype[name]; 112 return _devicetype[name];
104 } 113 }
105 else 114 else
106 { 115 {
107 return 0; 116 return 0;
108 } 117 }
109}; 118};
110 119
111 120
112int WellenreiterConfigWindow::hoppingInterval() const 121int WellenreiterConfigWindow::hoppingInterval() const
113{ 122{
114 return hopInterval->cleanText().toInt(); 123 return hopInterval->cleanText().toInt();
115} 124}
116 125
117 126
118bool WellenreiterConfigWindow::usePrismHeader() const 127bool WellenreiterConfigWindow::usePrismHeader() const
119{ 128{
120 return prismHeader->isOn(); 129 return prismHeader->isOn();
121} 130}
122 131
123 132
124bool WellenreiterConfigWindow::isChannelChecked( int channel ) const 133bool WellenreiterConfigWindow::isChannelChecked( int channel ) const
125{ 134{
126 switch ( channel ) 135 switch ( channel )
127 { 136 {
128 case 1: return channel1->isOn(); 137 case 1: return channel1->isOn();
129 case 2: return channel2->isOn(); 138 case 2: return channel2->isOn();
130 case 3: return channel3->isOn(); 139 case 3: return channel3->isOn();
131 case 4: return channel4->isOn(); 140 case 4: return channel4->isOn();
132 case 5: return channel5->isOn(); 141 case 5: return channel5->isOn();
133 case 6: return channel6->isOn(); 142 case 6: return channel6->isOn();
134 case 7: return channel7->isOn(); 143 case 7: return channel7->isOn();
135 case 8: return channel8->isOn(); 144 case 8: return channel8->isOn();
136 case 9: return channel9->isOn(); 145 case 9: return channel9->isOn();
137 case 10: return channel10->isOn(); 146 case 10: return channel10->isOn();
138 case 11: return channel11->isOn(); 147 case 11: return channel11->isOn();
139 case 12: return channel12->isOn(); 148 case 12: return channel12->isOn();
140 case 13: return channel13->isOn(); 149 case 13: return channel13->isOn();
141 case 14: return channel14->isOn(); 150 case 14: return channel14->isOn();
142 } 151 }
143} 152}
144 153
145 154
146void WellenreiterConfigWindow::changedDeviceType(int t) 155void WellenreiterConfigWindow::changedDeviceType(int t)
147{ 156{
148 if ( t != DEVTYPE_FILE ) return; 157 if ( t != DEVTYPE_FILE ) return;
149 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); 158 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false);
150 if ( !name.isEmpty() && QFile::exists( name ) ) 159 if ( !name.isEmpty() && QFile::exists( name ) )
151 { 160 {
152 interfaceName->insertItem( name ); 161 interfaceName->insertItem( name );
153 interfaceName->setCurrentItem( interfaceName->count()-1 ); 162 interfaceName->setCurrentItem( interfaceName->count()-1 );
154 } 163 }
155 else 164 else
156 { 165 {
157 deviceType->setCurrentItem( _guess ); 166 deviceType->setCurrentItem( _guess );
158 } 167 }
159 168
160} 169}
161 170
162 171
163void WellenreiterConfigWindow::getCaptureFileNameClicked() 172void WellenreiterConfigWindow::getCaptureFileNameClicked()
164{ 173{
165 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); 174 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
166 qDebug( "name = %s", (const char*) name ); 175 qDebug( "name = %s", (const char*) name );
167 if ( !name.isEmpty() ) 176 if ( !name.isEmpty() )
168 { 177 {
169 captureFileName->setText( name ); 178 captureFileName->setText( name );
170 } 179 }
171} 180}
172 181
173 182
174void WellenreiterConfigWindow::channelAllClicked(int state) 183void WellenreiterConfigWindow::channelAllClicked(int state)
175{ 184{
176 bool b = state; 185 bool b = state;
177 channel1->setChecked( b ); 186 channel1->setChecked( b );
178 channel2->setChecked( b ); 187 channel2->setChecked( b );
179 channel3->setChecked( b ); 188 channel3->setChecked( b );
180 channel4->setChecked( b ); 189 channel4->setChecked( b );
181 channel5->setChecked( b ); 190 channel5->setChecked( b );
182 channel6->setChecked( b ); 191 channel6->setChecked( b );
183 channel7->setChecked( b ); 192 channel7->setChecked( b );
184 channel8->setChecked( b ); 193 channel8->setChecked( b );
185 channel9->setChecked( b ); 194 channel9->setChecked( b );
186 channel10->setChecked( b ); 195 channel10->setChecked( b );
187 channel11->setChecked( b ); 196 channel11->setChecked( b );
188 channel12->setChecked( b ); 197 channel12->setChecked( b );
189 channel13->setChecked( b ); 198 channel13->setChecked( b );
190 channel14->setChecked( b ); 199 channel14->setChecked( b );
191} 200}
192 201
193 202
194bool WellenreiterConfigWindow::useGPS() const 203bool WellenreiterConfigWindow::useGPS() const
195{ 204{
196 return enableGPS->isChecked(); 205 return enableGPS->isChecked();
197} 206}
198 207
199 208
200const QString WellenreiterConfigWindow::gpsHost() const 209const QString WellenreiterConfigWindow::gpsHost() const
201{ 210{
202 return useGPS() ? gpsdHost->currentText() : QString::null; 211 return useGPS() ? gpsdHost->currentText() : QString::null;
203} 212}
204 213
205 214
206int WellenreiterConfigWindow::gpsPort() const 215int WellenreiterConfigWindow::gpsPort() const
207{ 216{
208 bool ok; 217 bool ok;
209 return useGPS() ? gpsdPort->value() : -1; 218 return useGPS() ? gpsdPort->value() : -1;
210} 219}
220
221
222bool WellenreiterConfigWindow::load()
223{
224#ifdef Q_WS_X11
225 #warning Persistent Configuration not yet implemented for standalone X11 build
226 return false;
227#else
228 qDebug( "loading configuration settings..." );
229 return true;
230#endif
231}
232
233
234void WellenreiterConfigWindow::save()
235{
236#ifdef Q_WS_X11
237 #warning Persistent Configuration not yet implemented for standalone X11 build
238#else
239 qDebug( "saving configuration settings..." );
240#endif
241}
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h
index 8f160b1..2986320 100644
--- a/noncore/net/wellenreiter/gui/configwindow.h
+++ b/noncore/net/wellenreiter/gui/configwindow.h
@@ -1,66 +1,71 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITERCONFIGWINDOW_H 16#ifndef WELLENREITERCONFIGWINDOW_H
17#define WELLENREITERCONFIGWINDOW_H 17#define WELLENREITERCONFIGWINDOW_H
18 18
19#include "configbase.h" 19#include "configbase.h"
20#include <qmap.h> 20#include <qmap.h>
21#include <qcombobox.h> 21#include <qcombobox.h>
22#include <qstring.h> 22#include <qstring.h>
23 23
24const int DEVTYPE_SELECT = 0; 24const int DEVTYPE_SELECT = 0;
25const int DEVTYPE_CISCO = 1; 25const int DEVTYPE_CISCO = 1;
26const int DEVTYPE_WLAN_NG = 2; 26const int DEVTYPE_WLAN_NG = 2;
27const int DEVTYPE_HOSTAP = 3; 27const int DEVTYPE_HOSTAP = 3;
28const int DEVTYPE_ORINOCO = 4; 28const int DEVTYPE_ORINOCO = 4;
29const int DEVTYPE_MANUAL = 5; 29const int DEVTYPE_MANUAL = 5;
30const int DEVTYPE_FILE = 6; 30const int DEVTYPE_FILE = 6;
31 31
32class WellenreiterConfigWindow; 32class WellenreiterConfigWindow;
33 33
34class WellenreiterConfigWindow : public WellenreiterConfigBase 34class WellenreiterConfigWindow : public WellenreiterConfigBase
35{ 35{
36 Q_OBJECT 36 Q_OBJECT
37 37
38 public: 38 public:
39 WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); 39 WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 );
40 ~WellenreiterConfigWindow();
41
40 int driverType() const; 42 int driverType() const;
41 const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ }; 43 const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ };
42 const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ }; 44 const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ };
43 static WellenreiterConfigWindow* instance() { return _instance; }; 45 static WellenreiterConfigWindow* instance() { return _instance; };
44 46
45 int hoppingInterval() const; 47 int hoppingInterval() const;
46 bool usePrismHeader() const; 48 bool usePrismHeader() const;
47 bool isChannelChecked( int ) const; 49 bool isChannelChecked( int ) const;
48 50
49 bool useGPS() const; 51 bool useGPS() const;
50 const QString gpsHost() const; 52 const QString gpsHost() const;
51 int gpsPort() const; 53 int gpsPort() const;
52 54
55 void save();
56 bool load();
57
53 public slots: 58 public slots:
54 void changedDeviceType(int); 59 void changedDeviceType(int);
55 void getCaptureFileNameClicked(); 60 void getCaptureFileNameClicked();
56 61
57 void channelAllClicked(int); 62 void channelAllClicked(int);
58 63
59 protected: 64 protected:
60 QMap<QString, int> _devicetype; 65 QMap<QString, int> _devicetype;
61 static WellenreiterConfigWindow* _instance; 66 static WellenreiterConfigWindow* _instance;
62 int _guess; 67 int _guess;
63 68
64}; 69};
65 70
66#endif 71#endif