summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/accounts.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/accounts.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp40
1 files changed, 7 insertions, 33 deletions
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp
index 19db9ef..11d4739 100644
--- a/noncore/settings/networksettings/ppp/accounts.cpp
+++ b/noncore/settings/networksettings/ppp/accounts.cpp
@@ -50,37 +50,24 @@
50 50
51void parseargs(char* buf, char** args); 51void parseargs(char* buf, char** args);
52 52
53AccountWidget::AccountWidget( QWidget *parent, const char *name ) 53AccountWidget::AccountWidget( QWidget *parent, const char *name )
54 : QWidget( parent, name ) 54 : QWidget( parent, name )
55{ 55{
56// int min = 0;
57 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10); 56 QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
58
59 // add a hbox
60// QHBoxLayout *l11 = new QHBoxLayout;
61// l1->addLayout(l11);
62
63 accountlist_l = new QListBox(this); 57 accountlist_l = new QListBox(this);
64// accountlist_l->setMinimumSize(160, 128); 58
65 connect(accountlist_l, SIGNAL(highlighted(int)), 59 connect(accountlist_l, SIGNAL(highlighted(int)),
66 this, SLOT(slotListBoxSelect(int))); 60 this, SLOT(slotListBoxSelect(int)));
67 connect(accountlist_l, SIGNAL(selected(int)), 61 connect(accountlist_l, SIGNAL(selected(int)),
68 this, SLOT(editaccount())); 62 this, SLOT(editaccount()));
69 l1->addWidget(accountlist_l, 10); 63 l1->addWidget(accountlist_l, 10);
70 64
71// QVBoxLayout *l111 = new QVBoxLayout(this);
72// l11->addLayout(l111, 1);
73 edit_b = new QPushButton(i18n("&Edit..."), this); 65 edit_b = new QPushButton(i18n("&Edit..."), this);
74 connect(edit_b, SIGNAL(clicked()), SLOT(editaccount())); 66 connect(edit_b, SIGNAL(clicked()), SLOT(editaccount()));
75 QWhatsThis::add(edit_b, i18n("Allows you to modify the selected account")); 67 QWhatsThis::add(edit_b, i18n("Allows you to modify the selected account"));
76
77// min = edit_b->sizeHint().width();
78// min = QMAX(70,min);
79// edit_b->setMinimumWidth(min);
80
81 l1->addWidget(edit_b); 68 l1->addWidget(edit_b);
82 69
83 new_b = new QPushButton(i18n("&New..."), this); 70 new_b = new QPushButton(i18n("&New..."), this);
84 connect(new_b, SIGNAL(clicked()), SLOT(newaccount())); 71 connect(new_b, SIGNAL(clicked()), SLOT(newaccount()));
85 l1->addWidget(new_b); 72 l1->addWidget(new_b);
86 QWhatsThis::add(new_b, i18n("Create a new dialup connection\n" 73 QWhatsThis::add(new_b, i18n("Create a new dialup connection\n"
@@ -169,44 +156,31 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name )
169 for(int i=0; i <= PPPData::data()->count()-1; i++) { 156 for(int i=0; i <= PPPData::data()->count()-1; i++) {
170 PPPData::data()->setAccountbyIndex(i); 157 PPPData::data()->setAccountbyIndex(i);
171 accountlist_l->insertItem(PPPData::data()->accname()); 158 accountlist_l->insertItem(PPPData::data()->accname());
172 } 159 }
173 } 160 }
174 161
175 slotListBoxSelect(accountlist_l->currentItem()); 162// slotListBoxSelect(accountlist_l->currentItem());
163 qDebug("setting listview index to %i",PPPData::data()->currentAccountID() );
164 accountlist_l->setCurrentItem( PPPData::data()->currentAccountID() );
165// slotListBoxSelect( PPPData::data()->currentAccountID());
176 166
177 l1->activate(); 167 l1->activate();
178} 168}
179 169
180 170
181 171
182void AccountWidget::slotListBoxSelect(int idx) { 172void AccountWidget::slotListBoxSelect(int idx) {
183 delete_b->setEnabled((bool)(idx != -1)); 173 delete_b->setEnabled((bool)(idx != -1));
184 edit_b->setEnabled((bool)(idx != -1)); 174 edit_b->setEnabled((bool)(idx != -1));
185 copy_b->setEnabled((bool)(idx != -1)); 175 copy_b->setEnabled((bool)(idx != -1));
186 if(idx!=-1) { 176 if(idx!=-1) {
177 qDebug("setting account to %i", idx);
187 QString account = PPPData::data()->accname(); 178 QString account = PPPData::data()->accname();
188 PPPData::data()->setAccountbyIndex(accountlist_l->currentItem()); 179 PPPData::data()->setAccountbyIndex(accountlist_l->currentItem());
189// reset->setEnabled(TRUE); 180 // PPPData::data()->setAccount(account);
190// costlabel->setEnabled(TRUE);
191// costedit->setEnabled(TRUE);
192// costedit->setText(AccountingBase::getCosts(accountlist_l->text(accountlist_l->currentItem())));
193
194// vollabel->setEnabled(TRUE);
195// voledit->setEnabled(TRUE);
196// int bytes = PPPData::data()->totalBytes();
197// voledit->setText(prettyPrintVolume(bytes));
198 PPPData::data()->setAccount(account);
199 } else{
200 // reset->setEnabled(FALSE);
201// costlabel->setEnabled(FALSE);
202// costedit->setText("");
203// costedit->setEnabled(FALSE);
204// vollabel->setEnabled(FALSE);
205// voledit->setText("");
206// voledit->setEnabled(FALSE);
207 } 181 }
208} 182}
209 183
210 184
211// void AccountWidget::viewLogClicked(){ 185// void AccountWidget::viewLogClicked(){
212 186