From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- libkcddb/kcmcddb/cddbconfigwidget.cpp | 108 ++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 libkcddb/kcmcddb/cddbconfigwidget.cpp (limited to 'libkcddb/kcmcddb/cddbconfigwidget.cpp') diff --git a/libkcddb/kcmcddb/cddbconfigwidget.cpp b/libkcddb/kcmcddb/cddbconfigwidget.cpp new file mode 100644 index 00000000..067af2e0 --- /dev/null +++ b/libkcddb/kcmcddb/cddbconfigwidget.cpp @@ -0,0 +1,108 @@ +/* + Copyright (C) 2002 Rik Hemsley (rikkus) + Copyright (C) 2002 Benjamin Meyer + Copyright (C) 2004 Richard Lärkäng + + 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; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "cddbconfigwidget.h" + +#include "libkcddb/sites.h" +#include "libkcddb/lookup.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +CDDBConfigWidget::CDDBConfigWidget(QWidget * parent, const char * name) + : CDDBConfigWidgetBase(parent, name) +{ + // Connections from widgets are made in designer. + + KURLRequester* urlReq = new KURLRequester(this); + urlReq->setMode(KFile::Directory); + + KEditListBox* editListBox = new KEditListBox(i18n("Cache Locations"), urlReq->customEditor(), cacheLocationsParent, "kcfg_cacheLocations"); + cacheLocationsParent->raiseWidget(editListBox); + + kcfg_submitTransport->remove(needsAuthenticationBox); +} + +void CDDBConfigWidget::showMirrorList() +{ + KCDDB::Sites s; + + QValueList sites = s.siteList(); + QMap keys; + for (QValueList::Iterator it = sites.begin(); it != sites.end(); ++it) + if ((*it).transport == KCDDB::Lookup::CDDBP) + keys[(*it).address + "(CDDBP, " + QString::number((*it).port) + ") " + (*it).description] = *it; + else + keys[(*it).address + "(HTTP, " + QString::number((*it).port) + ") " + (*it).description] = *it; + + bool ok; + + if (keys.isEmpty()) + { + KMessageBox::information(this, i18n("Could not fetch mirror list."), i18n("Could Not Fetch")); + return; + } + + QStringList result = KInputDialog::getItemList(i18n("Select mirror"), + i18n("Select one of these mirrors"), keys.keys(), + QStringList(), false, &ok, this); + + if (ok && result.count() == 1) + { + KCDDB::Mirror m = keys[*(result.begin())]; + + kcfg_lookupTransport->setCurrentItem(m.transport == KCDDB::Lookup::CDDBP ? 0 : 1); + kcfg_hostname->setText(m.address); + kcfg_port->setValue(m.port); + } +} + +void CDDBConfigWidget::protocolChanged() +{ + // Change the port if the port is the default-value for the old protocol + + if (kcfg_lookupTransport->currentText() == i18n("HTTP") && kcfg_port->value() == 8880) + kcfg_port->setValue(80); + else if (kcfg_lookupTransport->currentText() == i18n("CDDB") && kcfg_port->value() == 80) + kcfg_port->setValue(8880); +} + +void CDDBConfigWidget::needAuthenticationChanged(bool needsAuth) +{ + kcfg_smtpUsername->setEnabled(needsAuth); + if (!needsAuth) + kcfg_smtpUsername->clear(); +} + +// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 + +#include "cddbconfigwidget.moc" -- cgit v1.2.3