diff options
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 )); +} |