diff options
Diffstat (limited to 'libkcddb/kcmcddb')
-rw-r--r-- | libkcddb/kcmcddb/Makefile.am | 23 | ||||
-rw-r--r-- | libkcddb/kcmcddb/cddbconfigwidget.cpp | 108 | ||||
-rw-r--r-- | libkcddb/kcmcddb/cddbconfigwidget.h | 43 | ||||
-rw-r--r-- | libkcddb/kcmcddb/cddbconfigwidgetbase.ui | 594 | ||||
-rw-r--r-- | libkcddb/kcmcddb/kcmcddb-emailsettings.upd | 6 | ||||
-rw-r--r-- | libkcddb/kcmcddb/kcmcddb.cpp | 132 | ||||
-rw-r--r-- | libkcddb/kcmcddb/kcmcddb.h | 55 | ||||
-rw-r--r-- | libkcddb/kcmcddb/libkcddb.desktop | 187 |
8 files changed, 1148 insertions, 0 deletions
diff --git a/libkcddb/kcmcddb/Makefile.am b/libkcddb/kcmcddb/Makefile.am new file mode 100644 index 00000000..cc638047 --- /dev/null +++ b/libkcddb/kcmcddb/Makefile.am @@ -0,0 +1,23 @@ +INCLUDES = -I$(srcdir)/../.. -I.. $(all_includes) + +kde_module_LTLIBRARIES = kcm_cddb.la + +kcm_cddb_la_SOURCES = \ + cddbconfigwidgetbase.ui cddbconfigwidget.cpp kcmcddb.cpp + +kcm_cddb_la_LDFLAGS = \ + $(all_libraries) -module -avoid-version -no-undefined + +kcm_cddb_la_LIBADD = ../libkcddb.la $(LIB_KDEUI) + +kcm_cddb_la_COMPILE_FIRST = ../configbase.h + +METASOURCES = AUTO + +xdg_apps_DATA = libkcddb.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kcmcddb.pot + +updatedir = $(kde_datadir)/kconf_update +update_DATA = kcmcddb-emailsettings.upd 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) <[email protected]> + Copyright (C) 2002 Benjamin Meyer <[email protected]> + Copyright (C) 2004 Richard Lärkäng <[email protected]> + + 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 <qlistbox.h> +#include <qcombobox.h> +#include <qspinbox.h> +#include <qlineedit.h> +#include <kfiledialog.h> +#include <kapplication.h> +#include <klocale.h> +#include <kinputdialog.h> +#include <kmessagebox.h> +#include <keditlistbox.h> +#include <qwidgetstack.h> +#include <kurlrequester.h> +#include <qbuttongroup.h> +#include <qcheckbox.h> + +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<KCDDB::Mirror> sites = s.siteList(); + QMap<QString, KCDDB::Mirror> keys; + for (QValueList<KCDDB::Mirror>::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" diff --git a/libkcddb/kcmcddb/cddbconfigwidget.h b/libkcddb/kcmcddb/cddbconfigwidget.h new file mode 100644 index 00000000..3d9136e6 --- /dev/null +++ b/libkcddb/kcmcddb/cddbconfigwidget.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2002 Rik Hemsley (rikkus) <[email protected]> + Copyright (C) 2002 Benjamin Meyer <[email protected]> + + 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. +*/ + +#ifndef CDDB_CONFIG_WIDGET_H +#define CDDB_CONFIG_WIDGET_H + +#include "cddbconfigwidgetbase.h" + +class CDDBConfigWidget : public CDDBConfigWidgetBase +{ + Q_OBJECT + + public: + + CDDBConfigWidget(QWidget * parent = 0, const char * name = 0); + + protected slots: + + virtual void showMirrorList(); + + virtual void protocolChanged(); + + virtual void needAuthenticationChanged(bool); +}; + +#endif // CDDB_CONFIG_WIDGET_H +// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 diff --git a/libkcddb/kcmcddb/cddbconfigwidgetbase.ui b/libkcddb/kcmcddb/cddbconfigwidgetbase.ui new file mode 100644 index 00000000..2158159a --- /dev/null +++ b/libkcddb/kcmcddb/cddbconfigwidgetbase.ui @@ -0,0 +1,594 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>CDDBConfigWidgetBase</class> +<comment>Used for configuring libkcddb.</comment> +<widget class="QWidget"> + <property name="name"> + <cstring>CDDBConfigWidgetBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>452</width> + <height>573</height> + </rect> + </property> + <property name="caption"> + <string>CDDB Settings</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QTabWidget"> + <property name="name"> + <cstring>tabWidget2</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Lookup</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>kcfg_cachePolicy</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>4</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Mode</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>6</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>cacheOnly</cstring> + </property> + <property name="text"> + <string>&Cache only</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Only check in the local cache for CD information.</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>cacheAndRemote</cstring> + </property> + <property name="text"> + <string>Cache &and remote</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Check for locally cached CD information before trying to look up at remote CDDB server.</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>remoteOnly</cstring> + </property> + <property name="text"> + <string>&Remote only</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Only try to look up at remote CDDB server.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>serverBox</cstring> + </property> + <property name="title"> + <string>CDDB Server</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel7</cstring> + </property> + <property name="text"> + <string>CDD&B server:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kcfg_hostname</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel9</cstring> + </property> + <property name="text"> + <string>&Transport:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kcfg_lookupTransport</cstring> + </property> + </widget> + <widget class="QComboBox" row="1" column="1"> + <item> + <property name="text"> + <string>CDDB</string> + </property> + </item> + <item> + <property name="text"> + <string>HTTP</string> + </property> + </item> + <property name="name"> + <cstring>kcfg_lookupTransport</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>Type of lookup which should be tried at the CDDB server.</string> + </property> + </widget> + <widget class="KPushButton" row="1" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>mirrorListButton</cstring> + </property> + <property name="text"> + <string>Show &Mirror List</string> + </property> + </widget> + <widget class="QSpinBox" row="0" column="4"> + <property name="name"> + <cstring>kcfg_port</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxValue"> + <number>64000</number> + </property> + <property name="value"> + <number>8880</number> + </property> + <property name="whatsThis" stdset="0"> + <string>Port to connect to on CDDB server.</string> + </property> + </widget> + <widget class="QLabel" row="0" column="3"> + <property name="name"> + <cstring>TextLabel8</cstring> + </property> + <property name="text"> + <string>&Port:</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignRight</set> + </property> + <property name="buddy" stdset="0"> + <cstring>kcfg_port</cstring> + </property> + </widget> + <widget class="QLineEdit" row="0" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kcfg_hostname</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>freedb.freedb.org</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Name of CDDB server which will be used to look up CD information.</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidgetStack"> + <property name="name"> + <cstring>cacheLocationsParent</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>WStackPage</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + </widget> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>41</width> + <height>260</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>&Submit</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>kcfg_emailAddress</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Email address:</string> + </property> + </widget> + <spacer row="2" column="1"> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>240</height> + </size> + </property> + </spacer> + <widget class="QButtonGroup" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kcfg_submitTransport</cstring> + </property> + <property name="title"> + <string>Submit Method</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="7" column="1"> + <property name="name"> + <cstring>spacer9</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>21</height> + </size> + </property> + </spacer> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="1" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Server:</string> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0" rowspan="1" colspan="6"> + <property name="name"> + <cstring>radioButton8</cstring> + </property> + <property name="text"> + <string>SMTP (Email)</string> + </property> + <property name="buttonGroupId"> + <number>1</number> + </property> + </widget> + <spacer row="3" column="0" rowspan="5" colspan="1"> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>140</height> + </size> + </property> + </spacer> + <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>radioButton6</cstring> + </property> + <property name="text"> + <string>HTTP</string> + </property> + <property name="buttonGroupId"> + <number>0</number> + </property> + </widget> + <widget class="KLineEdit" row="1" column="4" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kcfg_httpSubmitServer</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="6"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Port:</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignRight</set> + </property> + </widget> + <widget class="QSpinBox" row="1" column="7"> + <property name="name"> + <cstring>kcfg_httpSubmitPort</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="1" rowspan="1" colspan="4"> + <property name="name"> + <cstring>textLabel9_2</cstring> + </property> + <property name="text"> + <string>Reply-To:</string> + </property> + </widget> + <widget class="QLabel" row="4" column="1" rowspan="1" colspan="4"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>SMTP server:</string> + </property> + </widget> + <widget class="QLabel" row="5" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Port:</string> + </property> + </widget> + <widget class="QLineEdit" row="3" column="5" rowspan="1" colspan="3"> + <property name="name"> + <cstring>kcfg_replyTo</cstring> + </property> + </widget> + <widget class="QCheckBox" row="6" column="1" rowspan="1" colspan="7"> + <property name="name"> + <cstring>needsAuthenticationBox</cstring> + </property> + <property name="text"> + <string>Server needs authentication</string> + </property> + </widget> + <widget class="QLineEdit" row="4" column="5" rowspan="1" colspan="3"> + <property name="name"> + <cstring>kcfg_smtpHostname</cstring> + </property> + </widget> + <widget class="QLabel" row="7" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>Username:</string> + </property> + </widget> + <widget class="QLineEdit" row="7" column="5" rowspan="1" colspan="3"> + <property name="name"> + <cstring>kcfg_smtpUsername</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QSpinBox" row="5" column="3" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kcfg_smtpPort</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxValue"> + <number>65535</number> + </property> + <property name="value"> + <number>25</number> + </property> + </widget> + <spacer row="5" column="5" rowspan="1" colspan="3"> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>260</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </grid> + </widget> + </widget> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>cacheOnly</sender> + <signal>toggled(bool)</signal> + <receiver>serverBox</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>cacheAndRemote</sender> + <signal>toggled(bool)</signal> + <receiver>serverBox</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>remoteOnly</sender> + <signal>toggled(bool)</signal> + <receiver>serverBox</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>needsAuthenticationBox</sender> + <signal>toggled(bool)</signal> + <receiver>CDDBConfigWidgetBase</receiver> + <slot>needAuthenticationChanged(bool)</slot> + </connection> + <connection> + <sender>kcfg_lookupTransport</sender> + <signal>activated(int)</signal> + <receiver>CDDBConfigWidgetBase</receiver> + <slot>protocolChanged()</slot> + </connection> + <connection> + <sender>mirrorListButton</sender> + <signal>clicked()</signal> + <receiver>CDDBConfigWidgetBase</receiver> + <slot>showMirrorList()</slot> + </connection> +</connections> +<tabstops> + <tabstop>tabWidget2</tabstop> + <tabstop>cacheOnly</tabstop> + <tabstop>cacheAndRemote</tabstop> + <tabstop>remoteOnly</tabstop> + <tabstop>kcfg_hostname</tabstop> + <tabstop>kcfg_port</tabstop> + <tabstop>kcfg_lookupTransport</tabstop> +</tabstops> +<slots> + <slot access="protected">protocolChanged()</slot> + <slot access="protected">showMirrorList()</slot> + <slot access="protected">needAuthenticationChanged(bool)</slot> +</slots> +<layoutdefaults spacing="11" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>kpushbutton.h</includehint> + <includehint>klineedit.h</includehint> +</includehints> +</UI> diff --git a/libkcddb/kcmcddb/kcmcddb-emailsettings.upd b/libkcddb/kcmcddb/kcmcddb-emailsettings.upd new file mode 100644 index 00000000..4fc6c111 --- /dev/null +++ b/libkcddb/kcmcddb/kcmcddb-emailsettings.upd @@ -0,0 +1,6 @@ +Id=kcmcddb_emailsettings +File=kcmcddbrc +Group=Submit +Key=ownEmail,emailAddress +Key=ownReplyTo,replyTo +Key=ownSmtpHost,smtpHostname diff --git a/libkcddb/kcmcddb/kcmcddb.cpp b/libkcddb/kcmcddb/kcmcddb.cpp new file mode 100644 index 00000000..d5ca04a7 --- /dev/null +++ b/libkcddb/kcmcddb/kcmcddb.cpp @@ -0,0 +1,132 @@ +/* + Copyright (C) 2002 Rik Hemsley (rikkus) <[email protected]> + Copyright (C) 2002 Benjamin Meyer <[email protected]> + Copyright (C) 2003 Richard Lärkäng <[email protected]> + + 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 <qlayout.h> +#include <qcheckbox.h> +#include <qcombobox.h> +#include <qspinbox.h> +#include <qlineedit.h> +#include <qradiobutton.h> +#include <qlistbox.h> +#include <qlabel.h> +#include <qbuttongroup.h> + +#include <kconfig.h> +#include <klocale.h> +#include <kglobal.h> +#include <kgenericfactory.h> +#include <kmessagebox.h> +#include <kconfigdialogmanager.h> + +#include "cddbconfigwidget.h" + +#include "kcmcddb.h" +#include "libkcddb/lookup.h" +#include "libkcddb/cache.h" +#include "libkcddb/submit.h" + +typedef KGenericFactory<CDDBModule, QWidget> KCDDBFactory; +K_EXPORT_COMPONENT_FACTORY ( kcm_cddb, KCDDBFactory( "kcmcddb" ) ) + +CDDBModule::CDDBModule(QWidget *parent, const char *name, const QStringList &) + : KCModule(parent, name) +{ + KGlobal::locale()->insertCatalogue("libkcddb"); + setButtons(Default | Apply); + + widget_ = new CDDBConfigWidget(this); + + KCDDB::Config* cfg = new KCDDB::Config(); + cfg->readConfig(); + + addConfig(cfg, widget_); + + QVBoxLayout * layout = new QVBoxLayout(this, 0); + + layout->addWidget(widget_); + layout->addStretch(); + + setQuickHelp(i18n("CDDB is used to get information like artist, title and song-names in CD's")); + + load(); +} + + void +CDDBModule::defaults() +{ + KCModule::defaults(); + + updateWidgetsFromConfig(KCDDB::Config()); +} + + void +CDDBModule::checkSettings() const +{ + KCDDB::Config config; + + config.readConfig(); + + if (config.smtpHostname().isEmpty() || config.emailAddress().isEmpty() + || !config.emailAddress().contains("@") || + (!config.replyTo().isEmpty() && !config.replyTo().contains("@"))) + + { + if (config.submitTransport() == KCDDB::Submit::SMTP) + { + KMessageBox::sorry(widget_, i18n("freedb has been set to use HTTP for submissions " + "because the email details you have entered are " + "incomplete. Please review your email settings " + "and try again."), i18n("Incorrect Email Settings")); + config.setSubmitTransport(KCDDB::Submit::HTTP); + + config.writeConfig(); + } + } +} + + void +CDDBModule::updateWidgetsFromConfig(const KCDDB::Config & config) +{ + bool smtpUserIsEmpty = config.smtpUsername().isEmpty(); + widget_->needsAuthenticationBox->setChecked(!smtpUserIsEmpty); + widget_->kcfg_smtpUsername->setEnabled(!smtpUserIsEmpty); +} + + void +CDDBModule::save() +{ + KCModule::save(); + + checkSettings(); +} + + void +CDDBModule::load() +{ + KCModule::load(); + + KCDDB::Config config; + config.readConfig(); + updateWidgetsFromConfig(config); +} + +// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 + +#include "kcmcddb.moc" diff --git a/libkcddb/kcmcddb/kcmcddb.h b/libkcddb/kcmcddb/kcmcddb.h new file mode 100644 index 00000000..dfb7c4ef --- /dev/null +++ b/libkcddb/kcmcddb/kcmcddb.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2002 Rik Hemsley (rikkus) <[email protected]> + Copyright (C) 2002 Benjamin Meyer <[email protected]> + + 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. +*/ + +#ifndef KCMCDDB_H +#define KCMCDDB_H + +#include <kcmodule.h> + +#include "libkcddb/config.h" + +class CDDBConfigWidgetBase; +class KConfigDialogManager; + +class CDDBModule : public KCModule +{ + Q_OBJECT + + public: + + CDDBModule(QWidget * parent, const char *name, const QStringList &); + + public slots: + + void defaults(); + void save(); + void load(); + + protected: + + void checkSettings() const; + void updateWidgetsFromConfig(const KCDDB::Config &); + + private: + + CDDBConfigWidgetBase * widget_; +}; + +#endif // KCMCDDB_H +// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1 diff --git a/libkcddb/kcmcddb/libkcddb.desktop b/libkcddb/kcmcddb/libkcddb.desktop new file mode 100644 index 00000000..0c6e659c --- /dev/null +++ b/libkcddb/kcmcddb/libkcddb.desktop @@ -0,0 +1,187 @@ +[Desktop Entry] +Exec=kcmshell libkcddb +Icon=cdaudio_unmount +Type=Application +X-KDE-ModuleType=Library +X-KDE-Library=cddb + +Name=CDDB Retrieval +Name[bg]=Извличане от CDDB +Name[bs]=CDDB dobavljanje +Name[ca]=Recuperació CDDB +Name[cs]=Získání CDDB +Name[cy]=Cyrchu CDDB +Name[da]=CDDB-Hentning +Name[de]=CDDB-Abfrage +Name[el]=Ανάκτηση CDDB +Name[eo]=CDDB-serĉo +Name[es]=Recuperador de CDDB +Name[et]=CDDB ülekanded +Name[eu]=CDDB berreskuraketa +Name[fa]=بازیابی CDDB +Name[fi]=CDDB-haku +Name[fr]=Recherche CDDB +Name[ga]=Aisghabháil CDDB +Name[gl]=Obtención CDDB +Name[he]=אחזור CDDB +Name[hi]=सीडीडीबी रिट्राइवल +Name[hr]=Dohvat iz CDDB +Name[hu]=CDDB-lekérdezés +Name[is]=CDDB stillingar +Name[it]=Recupero CDDB +Name[ja]=CDDB 検索 +Name[kk]=CDDB деректерді алу +Name[ko]=CDDB 가져오기 +Name[lt]=CDDB įrašo atsisiuntimas +Name[mk]=Пребарување на CDDB +Name[ms]=Pembuka CDDB +Name[nb]=CDDB-henting +Name[nds]=CDDB-Affraag +Name[ne]=CDDB पुनः प्राप्ति +Name[nl]=CDDB-informatie +Name[nn]=CDDB-henting +Name[pa]=CDDB ਪਰਾਪਤੀ +Name[pl]=Pobieranie z CDDB +Name[pt]=Transferência de CDDB +Name[pt_BR]=Recuperação do CDDB +Name[ro]=Căutare CDDB +Name[ru]=Доступ к CDDB +Name[sk]=Informácie z CDDB +Name[sl]=Pridobivanje CDDB +Name[sr]=Добављање из CDDB-а +Name[sr@Latn]=Dobavljanje iz CDDB-a +Name[sv]=Hämta från CDDB +Name[ta]=குறுந்தகடு தகவல்தளம் மீட்டெடுப்பு +Name[tg]=Бозёбии CDDB +Name[th]=ดึงข้อมูล CDDB +Name[tr]=CDDB Erişimi +Name[uk]=Звантаження CDDB +Name[ven]=U humbula ha CDDB +Name[xh]=CDDB Ukukangela +Name[zh_CN]=CDDB 查询 +Name[zh_HK]=CDDB 資訊擷取 +Name[zh_TW]=CDDB 取得資訊 + +GenericName=CDDB Configuration +GenericName[ar]=اعدادت CDDB +GenericName[bg]=Настройки на CDDB +GenericName[br]=Kefluniadur CDDB +GenericName[bs]=Podešavanje CDDBa +GenericName[ca]=Configuració CDDB +GenericName[cs]=Nastavení CDDB +GenericName[cy]=Ffurfweddu CDDB +GenericName[da]=CDDB-Indstilling +GenericName[de]=CDDB-Einrichtung +GenericName[el]=Ρύθμιση CDDB +GenericName[eo]=LDDB-agordo +GenericName[es]=Configuración de CDDB +GenericName[et]=CDDB seadistamine +GenericName[eu]=CDDB konfigurazioa +GenericName[fa]=پیکربندی CDDB +GenericName[fi]=CDDB-asetukset +GenericName[fr]=Configuration CDDB +GenericName[ga]=Cumraíocht CDDB +GenericName[gl]=Configuración da CDDB +GenericName[he]=הגדרות CDDB +GenericName[hi]=सीडीडीबी कॉन्फ़िगरेशन +GenericName[hr]=Podešavanje CDDB-a +GenericName[hu]=CDDB-beállító +GenericName[is]=Stillingar CDDB +GenericName[it]=Configurazione CDDB +GenericName[ja]=CDDB の設定 +GenericName[kk]=CDDB баптауы +GenericName[km]=ការកំណត់រចនាសម្ព័ន្ធ CDDB +GenericName[ko]=CDDB 설정 +GenericName[lt]=CDDB konfigūravimas +GenericName[lv]=CDDB Konfigurācija +GenericName[mk]=Конфигурација на CDDB +GenericName[ms]=Penyelarasan CDDB +GenericName[nb]=CDDB-oppsett +GenericName[nds]=CDDB-Instellen +GenericName[ne]=CDDB कन्फिगरेसन +GenericName[nl]=CDDB instellingen +GenericName[nn]=CDDB-oppsett +GenericName[pa]=CDDB ਸੰਰਚਨਾ +GenericName[pl]=Konfiguracja CDDB +GenericName[pt]=Configuração do CDDB +GenericName[pt_BR]=Configuração do CDDB +GenericName[ro]=Configurează CDDB +GenericName[ru]=Настройка CDDB +GenericName[sk]=Nastavenie CDDB +GenericName[sl]=Nastavitve CDDB +GenericName[sr]=Подешавање CDDB-а +GenericName[sr@Latn]=Podešavanje CDDB-a +GenericName[sv]=CDDB-inställning +GenericName[ta]=குறுந்தகடு தகவல்தள வடிவமைப்பு +GenericName[tg]=Батанзимдарории CDDB +GenericName[th]=ปรับแต่ง CDDB +GenericName[tr]=CDDB Yapılandırması +GenericName[uk]=Налаштування CDDB +GenericName[uz]=CDDB moslamasi +GenericName[uz@cyrillic]=CDDB мосламаси +GenericName[ven]=Nzudzanyo ya CDDB +GenericName[wa]=Apontiaedje di CDDB +GenericName[zh_CN]=CDDB 配置 +GenericName[zh_HK]=CDDB 設定 +GenericName[zh_TW]=CDDB 設定 +GenericName[zu]=Uhlanganiso lwe CDDB + +Comment=Configure the CDDB Retrieval +Comment[bg]=Настройване на извличането от CDDB +Comment[bs]=Podesite CDDB dobavljanje +Comment[ca]=Configura la recuperació CDDB +Comment[cs]=Nastavení stahování z CDDB +Comment[cy]=Ffurfweddu Nôl o'r CDDB +Comment[da]=Indstil at hente via CDDB +Comment[de]=CDDB-Abfrage einrichten +Comment[el]=Ρύθμιση της ανάκτησης CDDB +Comment[eo]=Agordi la CDDB-serĉon +Comment[es]=Configurar el recuperador de CDDB +Comment[et]=CDDB ülekannete seadistamine +Comment[eu]=Konfiguratu CDDB berreskuraketa +Comment[fa]=پیکربندی بازیابی CDDB +Comment[fi]=Aseta CDDB-haku +Comment[fr]=Configurer la recherche CDDB +Comment[ga]=Cumraigh aisghabháil CDDB +Comment[gl]=Configurar as solicitudes á CDDB +Comment[he]=הגדר אחזור של CDDB +Comment[hu]=A CDDB-lekérdezés beállításai +Comment[is]=Stilling CDDB +Comment[it]=Configura il recupero CDDB +Comment[ja]=CDDB 検索の設定 +Comment[kk]=CDDB деректер алуды баптау +Comment[km]=កំណត់រចនាសម្ព័ន្ធ CDDB Retrieval +Comment[ko]=CDDB 가져오기 설정 +Comment[lt]=Čia galite konfigūruoti CDDB įrašų atsisiuntimą +Comment[mk]=Конфигурирање на пребарувањето на CDDB +Comment[nb]=Oppsett av CDDB-henting +Comment[nds]=CDDB-Affraag instellen +Comment[ne]=CDDB पुनः प्राप्ति कन्फिगर गर्नुहोस् +Comment[nl]=Ophalen van CDDB-informatie instellen +Comment[nn]=Oppsett av CDDB-henting +Comment[pa]=CDDB ਪਰਾਪਤੀ ਦੀ ਸੰਰਚਨਾ +Comment[pl]=Konfiguracja pobierania danych z CDDB +Comment[pt]=Configurar a Transferência de CDDB +Comment[pt_BR]=Configurar a recuperação do CDDB +Comment[ru]=Настройка CDDB +Comment[sk]=Nastavenie CDDB +Comment[sl]=Nastavi pridobivanje CDDB +Comment[sr]=Подешавање добављања CDDB-а +Comment[sr@Latn]=Podešavanje dobavljanja CDDB-a +Comment[sv]=Anpassa hämtning från CDDB +Comment[ta]=CDDB மீட்டெடுப்பை உள்ளமை +Comment[tg]=Танзими Бозёбии CDDB +Comment[th]=ปรับแต่งการดึงข้อมูลจาก CDDB +Comment[tr]=CDDB Erişimini Yapılandır +Comment[uk]=Налаштування звантаження CDDB +Comment[zh_CN]=配置 CDDB 获取 +Comment[zh_HK]=設定 CDDB 資訊擷取 +Comment[zh_TW]=CDDB 取得資訊設定 + +Keywords=cddb +Keywords[bg]=компактдиск, диск, извличане, информация, песен, база, данни, cddb +Keywords[hi]=सीडीडीबी +Keywords[nds]=CDDB +Keywords[ta]=குறுந்தகடு தகவல்தளம் + +Categories=Qt;KDE;Settings;X-KDE-settings-sound; |