From f4fae92b6768541e2952173c3d4b09040f95bf7e Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 16 Feb 2011 20:17:18 +0000 Subject: Moved kpilot from kdepim to applications, as the core Trinity libraries should not contain hardware-dependent software git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1221127 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kpilot/kpilot/dbSelectionDialog.cc | 144 ------------------------------------- 1 file changed, 144 deletions(-) delete mode 100644 kpilot/kpilot/dbSelectionDialog.cc (limited to 'kpilot/kpilot/dbSelectionDialog.cc') diff --git a/kpilot/kpilot/dbSelectionDialog.cc b/kpilot/kpilot/dbSelectionDialog.cc deleted file mode 100644 index 683b8a8c..00000000 --- a/kpilot/kpilot/dbSelectionDialog.cc +++ /dev/null @@ -1,144 +0,0 @@ -/* KPilot -** -** Copyright (C) 2003 Reinhold Kainhofer -** -** This file defines a dialog box that lets the -** user select a set of databases (e.g. which databases -** should be ignored when doing a backup) -*/ - -/* -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation; either version 2 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program in a file called COPYING; if not, write to -** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -** MA 02110-1301, USA. -*/ - -/* -** Bug reports and questions can be sent to kde-pim@kde.org -*/ - -#include "options.h" - -#include -#include -#include -#include -#include -#include - -#include "dbSelection_base.h" -#include "dbSelectionDialog.moc" - - -KPilotDBSelectionDialog::KPilotDBSelectionDialog(TQStringList &selectedDBs, TQStringList &deviceDBs, - TQStringList &addedDBs, TQWidget *w, const char *n) : - KDialogBase(w, n, true, TQString::null, KDialogBase::Ok | KDialogBase::Cancel, - KDialogBase::Ok, false), - fSelectedDBs(selectedDBs), - fAddedDBs(addedDBs), - fDeviceDBs(deviceDBs) -{ - FUNCTIONSETUP; - - fSelectionWidget = new KPilotDBSelectionWidget(this); - setMainWidget(fSelectionWidget); - - // Fill the encodings list - TQStringList items(deviceDBs); - for ( TQStringList::Iterator it = fAddedDBs.begin(); it != fAddedDBs.end(); ++it ) { - if (items.contains(*it)==0) items << (*it); - } - for ( TQStringList::Iterator it = fSelectedDBs.begin(); it != fSelectedDBs.end(); ++it ) { - if (items.contains(*it)==0) items << (*it); - } - items.sort(); - - for ( TQStringList::Iterator it = items.begin(); it != items.end(); ++it ) { - TQCheckListItem*checkitem=new TQCheckListItem(fSelectionWidget->fDatabaseList, - *it, TQCheckListItem::CheckBox); - if (fSelectedDBs.contains(*it)) checkitem->setOn(true); - } - - connect(fSelectionWidget->fNameEdit, TQT_SIGNAL(textChanged( const TQString & )), - this, TQT_SLOT(slotTextChanged( const TQString &))); - connect(fSelectionWidget->fAddButton, TQT_SIGNAL(clicked()), - this, TQT_SLOT(addDB())); - connect(fSelectionWidget->fRemoveButton, TQT_SIGNAL(clicked()), - this, TQT_SLOT(removeDB())); -} - -KPilotDBSelectionDialog::~KPilotDBSelectionDialog() -{ - FUNCTIONSETUP; -} - -void KPilotDBSelectionDialog::addDB() -{ - FUNCTIONSETUP; - TQString dbname(fSelectionWidget->fNameEdit->text()); - if (!dbname.isEmpty()) - { - fSelectionWidget->fNameEdit->clear(); - new TQCheckListItem(fSelectionWidget->fDatabaseList, dbname, - TQCheckListItem::CheckBox); - fAddedDBs << dbname; - } -} - -void KPilotDBSelectionDialog::removeDB() -{ - FUNCTIONSETUP; - TQListViewItem*item(fSelectionWidget->fDatabaseList->selectedItem()); - if (item) - { - TQString dbname=item->text(0); - if (fDeviceDBs.contains(dbname)) - { - KMessageBox::error(this, i18n("This is a database that exists on the device. It was not added manually, so it can not removed from the list."), i18n("Database on Device")); - } - else - { - fSelectedDBs.remove(dbname); - fAddedDBs.remove(dbname); - KPILOT_DELETE(item); - } - } - else - { - KMessageBox::information(this, i18n("You need to select a database to delete in the list."),i18n("No Database Selected"), CSL1("NoDBSelected")); - } -} - -TQStringList KPilotDBSelectionDialog::getSelectedDBs() -{ - fSelectedDBs.clear(); - - // update the list of selected databases - TQListViewItemIterator it( fSelectionWidget->fDatabaseList ); - while ( it.current() ) { - TQCheckListItem *item = dynamic_cast(it.current()); - ++it; - - if ( item && item->isOn() ) - fSelectedDBs << item->text(); - } - - return fSelectedDBs; -} - -void KPilotDBSelectionDialog::slotTextChanged( const TQString& dbname) -{ - FUNCTIONSETUP; - fSelectionWidget->fAddButton->setDisabled(dbname.isEmpty()); -} -- cgit v1.2.3