Add ICQ feature 122468: Notification if someone reads your away message
[kdenetwork.git] / krdc / hostprofiles.ui.h
blob25ecaebecd5b4feb4487b203048e5a0227c23cc2
1 /****************************************************************************
2 ** ui.h extension file, included from the uic-generated form implementation.
3 **
4 ** If you wish to add, delete or rename functions or slots use
5 ** Qt Designer which will update this file, preserving your code. Create an
6 ** init() function in place of a constructor, and a destroy() function in
7 ** place of a destructor.
8 *****************************************************************************/
10 void HostProfiles::removeHost()
12 HostPreferences *hps = HostPreferences::instance();
14 Q3ListViewItemIterator it(hostListView);
15 while (it.current())
17 Q3ListViewItem *vi = it.current();
18 if (vi->isSelected())
20 HostPrefPtr hp = hps->getHostPref(vi->text(0), vi->text(1));
21 if (hp)
22 deletedHosts += hp;
23 delete vi;
25 else
26 ++it;
28 removeAllButton->setEnabled(hostListView->childCount() > 0);
31 void HostProfiles::removeAllHosts()
33 HostPreferences *hps = HostPreferences::instance();
35 Q3ListViewItemIterator it(hostListView);
36 while (it.current())
38 Q3ListViewItem *vi = it.current();
39 HostPrefPtr hp = hps->getHostPref(vi->text(0), vi->text(1));
40 if (hp)
41 deletedHosts += hp;
42 ++it;
44 hostListView->clear();
45 removeAllButton->setEnabled(false);
49 void HostProfiles::selectionChanged()
51 Q3ListViewItemIterator it(hostListView);
52 while (it.current())
54 if (it.current()->isSelected())
56 removeHostButton->setEnabled(true);
57 return;
59 ++it;
61 removeHostButton->setEnabled(false);
65 void HostProfiles::load()
67 HostPreferences *hps = HostPreferences::instance();
69 HostPrefPtrList hplist = hps->getAllHostPrefs();
70 HostPrefPtrList::iterator it = hplist.begin();
71 while ( it != hplist.end() )
73 HostPref *hp = *it;
74 new K3ListViewItem( hostListView, hp->host(), hp->type(),
75 hp->prefDescription() );
76 ++it;
81 void HostProfiles::save()
83 HostPreferences *hps = HostPreferences::instance();
85 HostPrefPtrList::iterator it = deletedHosts.begin();
86 while (it != deletedHosts.end())
88 hps->removeHostPref(*it);
89 it++;
92 hps->sync();