diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /krdc/hostprofiles.ui.h | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krdc/hostprofiles.ui.h')
-rw-r--r-- | krdc/hostprofiles.ui.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/krdc/hostprofiles.ui.h b/krdc/hostprofiles.ui.h new file mode 100644 index 00000000..56c63f23 --- /dev/null +++ b/krdc/hostprofiles.ui.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** 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. +*****************************************************************************/ + +void HostProfiles::removeHost() +{ + HostPreferences *hps = HostPreferences::instance(); + + QListViewItemIterator it(hostListView); + while (it.current()) + { + QListViewItem *vi = it.current(); + if (vi->isSelected()) + { + HostPrefPtr hp = hps->getHostPref(vi->text(0), vi->text(1)); + if (hp) + deletedHosts += hp; + delete vi; + } + else + ++it; + } + removeAllButton->setEnabled(hostListView->childCount() > 0); +} + +void HostProfiles::removeAllHosts() +{ + HostPreferences *hps = HostPreferences::instance(); + + QListViewItemIterator it(hostListView); + while (it.current()) + { + QListViewItem *vi = it.current(); + HostPrefPtr hp = hps->getHostPref(vi->text(0), vi->text(1)); + if (hp) + deletedHosts += hp; + ++it; + } + hostListView->clear(); + removeAllButton->setEnabled(false); +} + + +void HostProfiles::selectionChanged() +{ + QListViewItemIterator it(hostListView); + while (it.current()) + { + if (it.current()->isSelected()) + { + removeHostButton->setEnabled(true); + return; + } + ++it; + } + removeHostButton->setEnabled(false); +} + + +void HostProfiles::load() +{ + HostPreferences *hps = HostPreferences::instance(); + + HostPrefPtrList hplist = hps->getAllHostPrefs(); + HostPrefPtrList::iterator it = hplist.begin(); + while ( it != hplist.end() ) + { + HostPref *hp = *it; + new KListViewItem( hostListView, hp->host(), hp->type(), + hp->prefDescription() ); + ++it; + } +} + + +void HostProfiles::save() +{ + HostPreferences *hps = HostPreferences::instance(); + + HostPrefPtrList::iterator it = deletedHosts.begin(); + while (it != deletedHosts.end()) + { + hps->removeHostPref(*it); + it++; + } + + hps->sync(); +} + +void HostProfiles::slotHostDoubleClicked( QListViewItem *vi ) +{ + HostPreferences *hps = HostPreferences::instance(); + HostPrefPtr hp = hps->getHostPref(vi->text(0), vi->text(1)); + emit( hostDoubleClicked( hp )); +} |