summaryrefslogtreecommitdiffstats
path: root/wifi/kcmwifi/configcrypto.ui.h
blob: 6ada4aa44440087e4861da338f92056b07d7e5f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/
#include <kdebug.h>
#include "wificonfig.h"

void ConfigCrypto::load( const IfConfig &ifconfig)
{
  cmb_activeKey->setCurrentItem( ifconfig.m_activeKey-1 );
  bg_cryptoMode->setButton( ifconfig.m_cryptoMode );
  
  le_key1->setText( ifconfig.m_keys[0].key() );
  le_key2->setText( ifconfig.m_keys[1].key() );
  le_key3->setText( ifconfig.m_keys[2].key() );
  le_key4->setText( ifconfig.m_keys[3].key() );
}

void ConfigCrypto::save( IfConfig &ifconfig )
{
  ifconfig.m_activeKey = cmb_activeKey->currentItem()+1;
  ifconfig.m_cryptoMode = (IfConfig::CryptoMode)bg_cryptoMode->selectedId();

  ifconfig.m_keys[0].setKey( le_key1->text() );
  ifconfig.m_keys[1].setKey( le_key2->text() );
  ifconfig.m_keys[2].setKey( le_key3->text() );
  ifconfig.m_keys[3].setKey( le_key4->text() );
}


void ConfigCrypto::slotUpdateKey1Status(const QString& key)
{
    KeyStates status = ::Key::isValid( key );
    switch (status) {
    case INVALID:
	format_1->setText("<font color=\"#ff0000\">unrecognised</font>");
	break;
    case EMPTY:
	format_1->setText("<font color=\"#000000\">slot empty</font>");
	break;
    case HEX_64:
	format_1->setText("<font color=\"#00b000\">WEP 64-Bit hex</font>");
	break;
    case HEX_128:
	format_1->setText("<font color=\"#00b000\">WEP 128-Bit hex</font>");
	break;
    case HEX_256:
	format_1->setText("<font color=\"#00b000\">WEP 256-Bit hex</font>");
	break;
    case STRING_64:
	format_1->setText("<font color=\"#00b000\">WEP 64-Bit string</font>");
	break;
    case STRING_128:
	format_1->setText("<font color=\"#00b000\">WEP 128-Bit string</font>");
	break;
    case STRING_256:
	format_1->setText("<font color=\"#00b000\">WEP 256-Bit string</font>");
	break;
	}
}

void ConfigCrypto::slotUpdateKey2Status(const QString& key)
{
    KeyStates status = ::Key::isValid( key );
    switch (status) {
    case INVALID:
	format_2->setText("<font color=\"#ff0000\">unrecognised</font>");
	break;
    case EMPTY:
	format_2->setText("<font color=\"#000000\">slot empty</font>");
	break;
    case HEX_64:
	format_2->setText("<font color=\"#00b000\">WEP 64-Bit hex</font>");
	break;
    case HEX_128:
	format_2->setText("<font color=\"#00b000\">WEP 128-Bit hex</font>");
	break;
    case HEX_256:
	format_2->setText("<font color=\"#00b000\">WEP 256-Bit hex</font>");
	break;
    case STRING_64:
	format_2->setText("<font color=\"#00b000\">WEP 64-Bit string</font>");
	break;
    case STRING_128:
	format_2->setText("<font color=\"#00b000\">WEP 128-Bit string</font>");
	break;
    case STRING_256:
	format_2->setText("<font color=\"#00b000\">WEP 256-Bit string</font>");
	break;
	}
}

void ConfigCrypto::slotUpdateKey3Status(const QString& key)
{
    KeyStates status = ::Key::isValid( key );
    switch (status) {
    case INVALID:
	format_3->setText("<font color=\"#ff0000\">unrecognised</font>");
	break;
    case EMPTY:
	format_3->setText("<font color=\"#000000\">slot empty</font>");
	break;
    case HEX_64:
	format_3->setText("<font color=\"#00b000\">WEP 64-Bit hex</font>");
	break;
    case HEX_128:
	format_3->setText("<font color=\"#00b000\">WEP 128-Bit hex</font>");
	break;
    case HEX_256:
	format_3->setText("<font color=\"#00b000\">WEP 256-Bit hex</font>");
	break;
    case STRING_64:
	format_3->setText("<font color=\"#00b000\">WEP 64-Bit string</font>");
	break;
    case STRING_128:
	format_3->setText("<font color=\"#00b000\">WEP 128-Bit string</font>");
	break;
    case STRING_256:
	format_3->setText("<font color=\"#00b000\">WEP 256-Bit string</font>");
	break;
	}
}

void ConfigCrypto::slotUpdateKey4Status(const QString& key)
{
    KeyStates status = ::Key::isValid( key );
    switch (status) {
    case INVALID:
	format_4->setText("<font color=\"#ff0000\">unrecognised</font>");
	break;
    case EMPTY:
	format_4->setText("<font color=\"#000000\">slot empty</font>");
	break;
    case HEX_64:
	format_4->setText("<font color=\"#00b000\">WEP 64-Bit hex</font>");
	break;
    case HEX_128:
	format_4->setText("<font color=\"#00b000\">WEP 128-Bit hex</font>");
	break;
    case HEX_256:
	format_4->setText("<font color=\"#00b000\">WEP 256-Bit hex</font>");
	break;
    case STRING_64:
	format_4->setText("<font color=\"#00b000\">WEP 64-Bit string</font>");
	break;
    case STRING_128:
	format_4->setText("<font color=\"#00b000\">WEP 128-Bit string</font>");
	break;
    case STRING_256:
	format_4->setText("<font color=\"#00b000\">WEP 256-Bit string</font>");
	break;
	}
}