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 /ktalkd/kcmktalkd | |
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 'ktalkd/kcmktalkd')
-rw-r--r-- | ktalkd/kcmktalkd/Makefile.am | 15 | ||||
-rw-r--r-- | ktalkd/kcmktalkd/answmachpage.cpp | 265 | ||||
-rw-r--r-- | ktalkd/kcmktalkd/answmachpage.h | 83 | ||||
-rw-r--r-- | ktalkd/kcmktalkd/cr128-app-ktalkd.png | bin | 0 -> 13158 bytes | |||
-rw-r--r-- | ktalkd/kcmktalkd/cr16-app-ktalkd.png | bin | 0 -> 792 bytes | |||
-rw-r--r-- | ktalkd/kcmktalkd/cr22-app-ktalkd.png | bin | 0 -> 1342 bytes | |||
-rw-r--r-- | ktalkd/kcmktalkd/cr32-app-ktalkd.png | bin | 0 -> 2133 bytes | |||
-rw-r--r-- | ktalkd/kcmktalkd/cr48-app-ktalkd.png | bin | 0 -> 3882 bytes | |||
-rw-r--r-- | ktalkd/kcmktalkd/forwmachpage.cpp | 183 | ||||
-rw-r--r-- | ktalkd/kcmktalkd/forwmachpage.h | 75 | ||||
-rw-r--r-- | ktalkd/kcmktalkd/kcmktalkd.desktop | 207 | ||||
-rw-r--r-- | ktalkd/kcmktalkd/main.cpp | 113 | ||||
-rw-r--r-- | ktalkd/kcmktalkd/main.h | 64 | ||||
-rw-r--r-- | ktalkd/kcmktalkd/soundpage.cpp | 330 | ||||
-rw-r--r-- | ktalkd/kcmktalkd/soundpage.h | 90 |
15 files changed, 1425 insertions, 0 deletions
diff --git a/ktalkd/kcmktalkd/Makefile.am b/ktalkd/kcmktalkd/Makefile.am new file mode 100644 index 00000000..21fddc81 --- /dev/null +++ b/ktalkd/kcmktalkd/Makefile.am @@ -0,0 +1,15 @@ +xdg_apps_DATA = kcmktalkd.desktop +KDE_ICON = ktalkd + +INCLUDES = $(all_includes) +METASOURCES=AUTO + +kde_module_LTLIBRARIES = kcm_ktalkd.la + +kcm_ktalkd_la_SOURCES = main.cpp soundpage.cpp answmachpage.cpp \ + forwmachpage.cpp +kcm_ktalkd_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +kcm_ktalkd_la_LIBADD = $(LIB_KDEUI) $(LIB_KIO) + +#for extra warnings during compilation : +# AMDEFS = -ansi -pedantic -D_POSIX_SOURCE -D_BSD_SOURCE diff --git a/ktalkd/kcmktalkd/answmachpage.cpp b/ktalkd/kcmktalkd/answmachpage.cpp new file mode 100644 index 00000000..5df2bee3 --- /dev/null +++ b/ktalkd/kcmktalkd/answmachpage.cpp @@ -0,0 +1,265 @@ +/* + * answmachpage.cpp - Answering machine settings for KTalkd + * + * Copyright (C) 1998 David Faure, [email protected] + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * 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 "answmachpage.h" + + +#include <ksimpleconfig.h> + +#include <stdlib.h> +#include <klocale.h> // for getenv + +KAnswmachPageConfig::KAnswmachPageConfig( QWidget *parent, const char* name, + KSimpleConfig *_config) + : KCModule (parent, name) +{ + if (!_config) { + delete_config = true; + config = new KSimpleConfig("ktalkdrc"); + } + else { + delete_config = false; + config = _config; + } + + answmach_cb = new QCheckBox(i18n("&Activate answering machine"), this); + answmach_cb->adjustSize(); + mail_edit = new QLineEdit(this); + mail_edit->adjustSize(); + mail_edit->setMinimumWidth(150); + mail_label = new QLabel(mail_edit,i18n("&Mail address:"),this); + mail_label->adjustSize(); + mail_label->setAlignment( ShowPrefix | AlignVCenter ); + + subj_edit = new QLineEdit(this); + subj_edit->adjustSize(); + subj_edit->setMinimumWidth(150); + subj_label = new QLabel(subj_edit, i18n("Mail s&ubject:"),this); + subj_label->adjustSize(); + subj_label->setAlignment( ShowPrefix | AlignVCenter ); + subj_tip = new QLabel(i18n("Use %s for the caller name"),this); + subj_tip->setAlignment( ShowPrefix ); + + head_edit = new QLineEdit(this); + head_edit->adjustSize(); + head_edit->setMinimumWidth(150); + head_label = new QLabel(head_edit, i18n("Mail &first line:"),this); + head_label->adjustSize(); + head_label->setAlignment( ShowPrefix | AlignVCenter ); + head_tip = new QLabel( + i18n("Use first %s for caller name, and second %s for caller hostname"), + this); + head_tip->setAlignment( ShowPrefix ); + + emptymail_cb = new QCheckBox(i18n("&Receive a mail even if no message left"), this); + emptymail_cb->adjustSize(); + + msg_ml = new QMultiLineEdit(this); + msg_ml->adjustSize(); + msg_ml->setMinimumWidth(150); + msg_label = new QLabel(msg_ml, i18n("&Banner displayed on answering machine startup:"),this); + msg_label->adjustSize(); + msg_label->setAlignment( ShowPrefix | AlignVCenter ); + + int h = 10 + answmach_cb->height() + mail_edit->height() + + subj_edit->height() + subj_tip->height() + head_edit->height() + + head_tip->height() + emptymail_cb->height() + + msg_label->height() + msg_ml->height() + 30; + setMinimumSize(400, h); // 400 : otherwise, buttons may overlap + msg_default = new QString(i18n("The person you are asking to talk with is not answering.\n" +"Please leave a message to be delivered via email.\n" +"Just start typing and when you have finished, exit normally.")); + + load(); + + connect(answmach_cb, SIGNAL(clicked()), this, SLOT(answmachOnOff())); + + // Emit changed(true) when anything changes + connect(answmach_cb, SIGNAL(clicked()), this, SLOT(slotChanged())); + connect(mail_edit, SIGNAL(textChanged(const QString&)), + this, SLOT(slotChanged())); + connect(subj_edit, SIGNAL(textChanged(const QString&)), + this, SLOT(slotChanged())); + connect(head_edit, SIGNAL(textChanged(const QString&)), + this, SLOT(slotChanged())); + connect(emptymail_cb, SIGNAL(clicked()), this, SLOT(slotChanged())); + connect(msg_ml, SIGNAL(textChanged()), this, SLOT(slotChanged())); + +} + +KAnswmachPageConfig::~KAnswmachPageConfig( ) { + if (delete_config) delete config; + delete answmach_cb; + delete mail_label; + delete mail_edit; + delete subj_label; + delete subj_edit; + delete subj_tip; + delete head_label; + delete head_edit; + delete head_tip; + delete emptymail_cb; + delete msg_label; + delete msg_ml; + delete msg_default; +} + +void KAnswmachPageConfig::slotChanged() { + emit changed(true); +} + +void KAnswmachPageConfig::resizeEvent(QResizeEvent *) { + + int h_txt = answmach_cb->height(); // taken for the general label height + int h_edt = mail_edit->height(); // taken for the general QLineEdit height + int spc = h_txt / 3; + int w = rect().width(); + + int leftedits = mail_label->width(); + if ( subj_label->width() > leftedits ) + leftedits = subj_label->width(); + if ( head_label->width() > leftedits ) + leftedits = head_label->width(); + leftedits += 20; + + int h = 10 + spc*2; + answmach_cb->move(10, h); + h += h_txt+spc; + mail_label->setFixedHeight(h_edt); // same size -> vertical center aligned + mail_label->move(10, h); + mail_edit->setGeometry(leftedits, h, w-leftedits-10, h_edt); + h += h_edt+spc; + + subj_label->setFixedHeight(h_edt); // same size -> vertical center aligned + subj_label->move(10, h); + subj_edit->setGeometry(leftedits, h, w-leftedits-10, h_edt); + h += h_edt+spc; + subj_tip->setFixedWidth(w-20); + subj_tip->move(leftedits, h); + h += h_txt+spc; + + head_label->setFixedHeight(h_edt); // same size -> vertical center aligned + head_label->move(10, h); + head_edit->setGeometry(leftedits, h, w-leftedits-10, h_edt); + h += h_edt+spc; + head_tip->setFixedWidth(w-20); + head_tip->move(leftedits, h); + h += h_txt+spc; + + emptymail_cb->move(10,h); + h += h_txt+spc; + + msg_label->move(10, h); + h += h_txt+spc; + + msg_ml->setGeometry(10, h, w-20, height() - h - 10); + h += h_edt+spc; +} + +void KAnswmachPageConfig::answmachOnOff() +{ + bool b = answmach_cb->isChecked(); + mail_label->setEnabled(b); + mail_edit->setEnabled(b); + subj_label->setEnabled(b); + subj_edit->setEnabled(b); + subj_tip->setEnabled(b); + head_label->setEnabled(b); + head_edit->setEnabled(b); + head_tip->setEnabled(b); + emptymail_cb->setEnabled(b); + msg_label->setEnabled(b); + msg_ml->setEnabled(b); +} + +void KAnswmachPageConfig::defaults() { + + answmach_cb->setChecked(true); + + mail_edit->setText(getenv("REPLYTO")); + subj_edit->setText(i18n("Message from %s")); + head_edit->setText(i18n("Message left on the answering machine, by %s@%s")); + + emptymail_cb->setChecked(true); + msg_ml->setText(*msg_default); + + // Activate things according to configuration + answmachOnOff(); + +} + +void KAnswmachPageConfig::load() { + + config->setGroup("ktalkd"); + + answmach_cb->setChecked(config->readBoolEntry("Answmach",true)); + + mail_edit->setText(config->readEntry("Mail",getenv("REPLYTO"))); + subj_edit->setText(config->readEntry("Subj",i18n("Message from %s"))); + head_edit->setText(config->readEntry("Head", + i18n("Message left on the answering machine, by %s@%s"))); + + emptymail_cb->setChecked(config->readBoolEntry("EmptyMail",true)); + + msg_ml->clear(); + char m[]="Msg1"; // used as key to read configuration + QString msg; + while (!(msg=config->readEntry(m)).isNull()) + { + msg_ml->append(msg); + ++m[3]; + } + + if (m[3]=='1') // nothing in the config file + msg_ml->setText(*msg_default); + + // Activate things according to configuration + answmachOnOff(); + + emit changed(false); +} + +void KAnswmachPageConfig::save() { + + config->setGroup("ktalkd"); + config->writeEntry("Answmach", answmach_cb->isChecked()); + config->writeEntry("Mail",mail_edit->text()); + config->writeEntry("Subj",subj_edit->text()); + config->writeEntry("Head",head_edit->text()); + config->writeEntry("EmptyMail", emptymail_cb->isChecked()); + char m[]="Msg1"; // used as key to read configuration + int linenr=0; + QString msg; + while ((linenr<8) && (linenr<msg_ml->numLines())) + { + config->writeEntry(m,msg_ml->textLine(linenr)); + ++m[3]; ++linenr; + } + config->deleteEntry(m,false/*non localized*/); + // necessary to avoid old msg lines to reappear after + // deleting some. + + config->sync(); +} + +#include "answmachpage.moc" diff --git a/ktalkd/kcmktalkd/answmachpage.h b/ktalkd/kcmktalkd/answmachpage.h new file mode 100644 index 00000000..e1615364 --- /dev/null +++ b/ktalkd/kcmktalkd/answmachpage.h @@ -0,0 +1,83 @@ +/* + * answmachpage.h + * + * Copyright (c) 1998 David Faure + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * 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 __KCONTROL_KANSWMACHPAGE_H__ +#define __KCONTROL_KANSWMACHPAGE_H__ + +#include <qdir.h> +/* has to be before everything because of #define Unsorted 0 in X11/X.h !! */ + +#include <qobject.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qmultilineedit.h> +#include <qpushbutton.h> +#include <qbutton.h> +#include <qcheckbox.h> + +#include <kcmodule.h> + +class KSimpleConfig; + +class KAnswmachPageConfig : public KCModule +{ + Q_OBJECT + +public: + KAnswmachPageConfig( QWidget *parent=0, const char* name=0, + KSimpleConfig *config=0 ); + ~KAnswmachPageConfig( ); + + void load(); + void save(); + void defaults(); + +protected: + void resizeEvent(QResizeEvent *e); + +private slots: + void answmachOnOff(); + void slotChanged(); + +private: + KSimpleConfig *config; + bool delete_config; + + QCheckBox *answmach_cb; + QLabel *mail_label; + QLineEdit *mail_edit; + QLabel *subj_label; + QLineEdit *subj_edit; + QLabel *subj_tip; + QLabel *head_label; + QLineEdit *head_edit; + QLabel *head_tip; + QCheckBox *emptymail_cb; + QLabel *msg_label; + QMultiLineEdit *msg_ml; + + QString *msg_default; +}; + +#endif + diff --git a/ktalkd/kcmktalkd/cr128-app-ktalkd.png b/ktalkd/kcmktalkd/cr128-app-ktalkd.png Binary files differnew file mode 100644 index 00000000..8d9c97f7 --- /dev/null +++ b/ktalkd/kcmktalkd/cr128-app-ktalkd.png diff --git a/ktalkd/kcmktalkd/cr16-app-ktalkd.png b/ktalkd/kcmktalkd/cr16-app-ktalkd.png Binary files differnew file mode 100644 index 00000000..fd36501c --- /dev/null +++ b/ktalkd/kcmktalkd/cr16-app-ktalkd.png diff --git a/ktalkd/kcmktalkd/cr22-app-ktalkd.png b/ktalkd/kcmktalkd/cr22-app-ktalkd.png Binary files differnew file mode 100644 index 00000000..9ac54546 --- /dev/null +++ b/ktalkd/kcmktalkd/cr22-app-ktalkd.png diff --git a/ktalkd/kcmktalkd/cr32-app-ktalkd.png b/ktalkd/kcmktalkd/cr32-app-ktalkd.png Binary files differnew file mode 100644 index 00000000..896c9be3 --- /dev/null +++ b/ktalkd/kcmktalkd/cr32-app-ktalkd.png diff --git a/ktalkd/kcmktalkd/cr48-app-ktalkd.png b/ktalkd/kcmktalkd/cr48-app-ktalkd.png Binary files differnew file mode 100644 index 00000000..0ad792c7 --- /dev/null +++ b/ktalkd/kcmktalkd/cr48-app-ktalkd.png diff --git a/ktalkd/kcmktalkd/forwmachpage.cpp b/ktalkd/kcmktalkd/forwmachpage.cpp new file mode 100644 index 00000000..5d82afed --- /dev/null +++ b/ktalkd/kcmktalkd/forwmachpage.cpp @@ -0,0 +1,183 @@ +/* + * forwmachpage.cpp - Forwarding machine settings for KTalkd + * + * Copyright (C) 1998 David Faure, [email protected] + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * 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 "forwmachpage.h" + +#include <ksimpleconfig.h> +#include <klocale.h> + +KForwmachPageConfig::KForwmachPageConfig( QWidget *parent, const char* name, + KSimpleConfig *_config) + : KCModule (parent, name) +{ + if (!_config) { + delete_config = true; + config = new KSimpleConfig("ktalkdrc"); + } + else { + delete_config = false; + config = _config; + } + forwmach_cb = new QCheckBox(i18n("Activate &forward"), this); + forwmach_cb->adjustSize(); + address_edit = new QLineEdit(this); + address_edit->adjustSize(); + address_edit->setMinimumWidth(150); + address_label = new QLabel(address_edit,i18n("&Destination (user or user@host):"),this); + address_label->adjustSize(); + address_label->setAlignment( ShowPrefix | AlignVCenter ); + + method_combo = new QComboBox(this); + method_combo->insertItem("FWA"); + method_combo->insertItem("FWR"); + method_combo->insertItem("FWT"); + method_combo->adjustSize(); + method_combo->setMinimumWidth(80); + method_label = new QLabel(method_combo, i18n("Forward &method:"),this); + method_label->adjustSize(); + method_label->setAlignment( ShowPrefix | AlignVCenter ); + + expl_label = new QLabel(i18n( +"FWA: Forward announcement only. Direct connection. Not recommended.\n\ +FWR: Forward all requests, changing info when necessary. Direct connection.\n\ +FWT: Forward all requests and handle the talk request. No direct connection.\n\ +\n\ +Recommended use: FWT if you want to use it behind a firewall (and if ktalkd\n\ +can access both networks). Otherwise choose FWR.\n\ +\n\ +See Help for further explanation.\n\ +"),this); + expl_label->adjustSize(); + + int h = 10 + forwmach_cb->height() + address_edit->height() + + method_combo->height()+expl_label->height()+30; + setMinimumSize(400, h); // 400: otherwise, buttons may overlap + + load(); + + connect(forwmach_cb, SIGNAL(clicked()), this, SLOT(forwmachOnOff())); + + // emit changed(true) on changes + connect(forwmach_cb, SIGNAL(clicked()), this, SLOT(slotChanged())); + connect(address_edit, SIGNAL(textChanged(const QString&)), this, SLOT(slotChanged())); + connect(method_combo, SIGNAL(activated(int)), this, SLOT(slotChanged())); +} + +KForwmachPageConfig::~KForwmachPageConfig( ) { + if (delete_config) delete config; + + /* I've been told that this is not necessary as + they will be deleted by Qt. But, well... */ + delete forwmach_cb; + delete address_label; + delete address_edit; + delete method_label; + delete method_combo; + delete expl_label; +} + +void KForwmachPageConfig::slotChanged() { + emit changed(true); +} + +void KForwmachPageConfig::resizeEvent(QResizeEvent *) { + int h_txt = forwmach_cb->height(); // taken for the general label height + int h_edt = address_edit->height(); // taken for the general QLineEdit height + int spc = h_txt / 3; + int w = rect().width(); + + int h = 10 + spc*2; + forwmach_cb->move(10, h); + h += h_txt+spc; + address_label->setFixedHeight(h_edt); // same size -> vertical center aligned + address_label->move(10, h); + int w_label = address_label->width()+20; + address_edit->setGeometry(w_label, h, w-w_label-10, h_edt); + h += h_edt+spc; + + method_label->setFixedHeight(h_edt); // same size -> vertical center aligned + method_label->move(10, h); + method_combo->move(w_label, h); + h += h_edt+spc; + + expl_label->move(10,h); + +} + +void KForwmachPageConfig::forwmachOnOff() { + bool b = forwmach_cb->isChecked(); + address_label->setEnabled(b); + address_edit->setEnabled(b); + method_label->setEnabled(b); + method_combo->setEnabled(b); + expl_label->setEnabled(b); +} + +void KForwmachPageConfig::defaults() { + + forwmach_cb->setChecked(false); + method_combo->setCurrentItem(1); + address_edit->setText(""); + + // Activate things according to configuration + forwmachOnOff(); + +} + +void KForwmachPageConfig::load() { + + config->setGroup("ktalkd"); + + QString forward = config->readEntry("Forward","unset"); + forwmach_cb->setChecked(forward!="unset"); + if (forward != "unset" ) + address_edit->setText(forward); + else + address_edit->setText(""); + + QString forwardMethod = config->readEntry("ForwardMethod","FWR"); + for (int i=0; i<method_combo->count(); i++) + if (forwardMethod == method_combo->text(i)) + method_combo->setCurrentItem(i); + + // Activate things according to configuration + forwmachOnOff(); + + emit changed(false); +} + +void KForwmachPageConfig::save() { + + config->setGroup("ktalkd"); + + if (forwmach_cb->isChecked()) + { + config->writeEntry("Forward",address_edit->text()); + } else + config->deleteEntry("Forward", false /*non localized*/); + config->writeEntry("ForwardMethod",method_combo->currentText()); + + config->sync(); +} + +#include "forwmachpage.moc" diff --git a/ktalkd/kcmktalkd/forwmachpage.h b/ktalkd/kcmktalkd/forwmachpage.h new file mode 100644 index 00000000..5db2a7ea --- /dev/null +++ b/ktalkd/kcmktalkd/forwmachpage.h @@ -0,0 +1,75 @@ +/* + * forwmachpage.h + * + * Copyright (c) 1998 David Faure + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * 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 __KCONTROL_KFORWMACHPAGE_H__ +#define __KCONTROL_KFORWMACHPAGE_H__ + +#include <qdir.h> +/* has to be before everything because of #define Unsorted 0 in X11/X.h !! */ + +#include <qobject.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qcombobox.h> +#include <qpushbutton.h> +#include <qbutton.h> +#include <qcheckbox.h> + +#include <kcmodule.h> + +class KSimpleConfig; + +class KForwmachPageConfig : public KCModule +{ + Q_OBJECT + +public: + KForwmachPageConfig( QWidget *parent=0, const char* name=0, + KSimpleConfig *config=0); + ~KForwmachPageConfig( ); + + void load(); + void save(); + void defaults(); + +protected: + void resizeEvent(QResizeEvent *e); + +private slots: + void forwmachOnOff(); + void slotChanged(); + +private: + KSimpleConfig *config; + bool delete_config; + + QCheckBox *forwmach_cb; + QLabel *address_label; + QLineEdit *address_edit; + QLabel *method_label; + QComboBox * method_combo; + QLabel *expl_label; +}; + +#endif + diff --git a/ktalkd/kcmktalkd/kcmktalkd.desktop b/ktalkd/kcmktalkd/kcmktalkd.desktop new file mode 100644 index 00000000..22422eb4 --- /dev/null +++ b/ktalkd/kcmktalkd/kcmktalkd.desktop @@ -0,0 +1,207 @@ +[Desktop Entry] +Icon=ktalkd +Type=Application +DocPath=kcontrol/kcmtalkd/index.html +Exec=kcmshell kcmktalkd + +X-KDE-ModuleType=Library +X-KDE-Library=ktalkd +X-KDE-FactoryName=ktalkd + +Name=Local Network Chat +Name[af]=Plaaslike Netwerk Gesels +Name[ar]=تحادث عبر الشبكة المحلية +Name[be]=Гутарка па мясцовай сетцы +Name[bg]=Разговор в локална мрежа +Name[bn]=স্থানীয় নেটওয়ার্ক চ্যাট +Name[br]=Flapañ rouedad lec'hel +Name[bs]=Chat u lokalnoj mreži +Name[ca]=Xat de la xarxa local +Name[cs]=Rozhovor v lokální síti +Name[cy]=Sgwrs Rhwydwaith Lleol +Name[da]=Lokalt netværk-chat +Name[de]=Lokaler Netzwerk-Chat +Name[el]=Συνομιλία στο τοπικό δίκτυο +Name[eo]=Loka reta Babilejo +Name[es]= Charla red local +Name[et]=Kohtvõrgu chat +Name[eu]=Sare lokaleko elkarrizketa +Name[fa]=گپ شبکۀ محلی +Name[fi]=Paikallinen verkkokeskustelu +Name[fr]=Discussion sur Réseau local +Name[gl]=Chat na rede local +Name[he]=שיחות ברשת המקומית +Name[hi]=स्थानीय नेटवर्क गपशप +Name[hr]=Razgovor u lokalnoj mreži +Name[hu]=Csevegés a helyi hálózaton +Name[is]=Staðarnetsspjall +Name[it]=Chat rete locale +Name[ja]=ローカルネットワークチャット +Name[ka]=ლოკალური ქსელის ჩატი +Name[kk]=Жергілікті желідегі әңгіме дүкені +Name[km]=ជជែកកំសាន្ដក្នុងបណ្ដាញមូលដ្ឋាន +Name[lt]=Vietinio tinklo pokalbiai +Name[mk]=Разговор на локална мрежа +Name[mn]=Дотоод сүлжээнд чалчих +Name[ms]=Borak Jaringan Setempat +Name[nb]=Lokalt nettverksprat +Name[nds]=Lokaalnettwark-Klönen +Name[ne]=स्थानीय सञ्जाल कुराकानी +Name[nl]=Gesprek over lokaal netwerk +Name[nn]=Lokal nettverksprat +Name[nso]=Poledisano ya Kgokagano ya Selegae +Name[pa]=ਲੋਕਲ ਨੈੱਟਵਰਕ ਗੱਲਬਾਤ +Name[pl]=Pogawędka w sieci lokalnej +Name[pt]=Conversação na Rede Local +Name[pt_BR]=Bate-papo de Rede Local +Name[ru]=Чат в локальной сети +Name[se]=Báikkalaš fierpmádatbuillardeapmi +Name[sk]=Rozhovor na lokálnej sieti +Name[sl]=Klepet prek lokalnega omrežja +Name[sr]=Ћаскање у локалној мрежи +Name[sr@Latn]=Ćaskanje u lokalnoj mreži +Name[sv]=Chatt via lokalt nätverk +Name[ta]=உள்ளக பிணைய அரட்டை +Name[tg]=Чати Шабакаи Маҳаллӣ +Name[th]=การสนทนาบนเครือข่ายท้องถิ่น +Name[tr]=Yerel Ağ Sohbeti +Name[uk]=Балачка в локальній мережі +Name[ven]=U davhidzana ha vhukwamani ha tsini +Name[xh]=Umsebenzi womnatha Wobulali Wokuncokola +Name[zh_CN]=局域网聊天 +Name[zh_HK]=區域網路聊天 +Name[zh_TW]=區域網路聊天室 +Name[zu]=Oluseduze Uxhumaniso olusakazekile + +Comment=Talk daemon configuration +Comment[af]=Praat bediener opstelling +Comment[ar]=اعدادات مراقب Talh +Comment[az]=Talk quraşdırması +Comment[be]=Настаўленне сервіса гутаркі +Comment[bg]=Настройване на демона за разговор в локална мрежа +Comment[bn]=টক(Talk) ডিমন কনফিগারেশন +Comment[br]=Kefluniadur an diaoul Talk +Comment[bs]=Podešavanje Talk demona +Comment[ca]=Configuració del dimoni talk +Comment[cs]=Nastavení talk démona +Comment[cy]=Ffurfweddiad daemon sgwrs +Comment[da]=Talkdæmon-indstilling +Comment[de]=Einrichtung des Talk-Dienstes +Comment[el]=Ρύθμιση του δαίμονα talk +Comment[eo]=Agordo de la "Talk"-demono +Comment[es]=Configuración del demonio Talk +Comment[et]=Talk deemoni seadistamine +Comment[eu]=Elkarrizketa deabruaren konfigurazioa +Comment[fa]=پیکربندی شبح گفتگو +Comment[fi]=Talk-palvelimen asetukset +Comment[fr]=Configuration du démon Talk +Comment[ga]=Cumraíocht deamhan comhrá +Comment[gl]=Configuración do demo talk +Comment[he]=שינוי הגדרות תהליך הרקע Talk +Comment[hi]=टाक डेमन कॉन्फ़िगरेशन +Comment[hr]=Postava talk daemona +Comment[hu]=A Talk szolgáltatás beállításai +Comment[id]=Konfigurasi daemon Talk +Comment[is]=Stillingar samtalsþjóns +Comment[it]=Configurazione demone talk +Comment[ja]=Talk デーモンの設定 +Comment[ka]=საუბრის დემონის კონფიგურაცია +Comment[kk]=Talk қызметінің параметрлері +Comment[km]=ការកំណត់រចនាសម្ព័ន្ធដេមិនសន្ទនា +Comment[ko]=이야기 데몬 설정 +Comment[lt]=Pokalbių tarnybos derinimas +Comment[mk]=Конфигурација на даемонот за разговарање +Comment[mn]=Talk демон тохируулга +Comment[ms]=Penyelarasan daemon Talk +Comment[mt]=Konfigurazzjoni tad-daemon Talk +Comment[nb]=Oppsett av Talk-nissen +Comment[nds]=Talkdämoon instellen +Comment[ne]=डेइमन कन्फिगरेसन बोल्नुहोस् +Comment[nl]=Talk-daemon instellen +Comment[nn]=Oppsett av Talk-nissen +Comment[nso]=Peakanyo ya daemon ya polelo +Comment[pa]=ਗੱਲਬਾਤ ਡੈਮਨ ਸੰਰਚਨਾ +Comment[pl]=Konfiguracja demona talk +Comment[pt]=Configuração do servidor do talk +Comment[pt_BR]=Configuração do servidor talk +Comment[ro]=Configurează demonul "talk" +Comment[ru]=Параметры службы Talk +Comment[se]=Heivet talk-duogášprográmma +Comment[sk]=Nastavenie talk démona +Comment[sl]=Nastavitev strežnika za talk +Comment[sr]=Подешавање „Talk“ демона +Comment[sr@Latn]=Podešavanje „Talk“ demona +Comment[sv]=Anpassa talk-demon +Comment[ta]=Talk daemon வடிவமைப்பு +Comment[tg]=Батанзимдарории азозили Talk +Comment[th]=ปรับแต่งเซิร์ฟเวอร์ Talk +Comment[tr]=Talk sunucu programı yapılandırması +Comment[uk]=Налаштування демону Talk +Comment[ven]=Nzudzanyo ya daemon yau amba +Comment[xh]=Uqwalaselo lwenkcoko ye daemon +Comment[zh_CN]=Talk 守护进程配置 +Comment[zh_HK]=Talk 系統程式設定 +Comment[zh_TW]=Talk 伺服程式組態 +Comment[zu]=Inhlanganiselo lwedaemon yenkulumo + +Keywords=talk,announcement,client,sound,answering,mail,caller,banner,forward,destination +Keywords[af]=talk,announcement,client,sound,answering,mail,caller,banner,forward,bestemming +Keywords[ar]=تحدث,اعلان,عميل,صوت,استجابة,بريد,متصل,شعار,ارسال,اتجاه +Keywords[az]=talk,e'lan,alıcı,Səs,cavablama,poçt,çağıran,bayraq,yolla,hədəf +Keywords[be]=гутарка,кліент,гук,адказ,прызначэнне,talk,announcement,client,sound,answering,mail,caller,banner,forward,destination +Keywords[bg]=разговор, локална, мрежа, чат, клиент, колега, talk, announcement, client, sound, answering, mail, caller, banner, forward, destination +Keywords[bs]=talk,announcement,client,sound,answering,mail,caller,banner,forward,destination,zvuk,klijent,odgovor,odredište +Keywords[ca]=parlar,notificació,client,so,contestar,correu,qui truca,rètol,enviar,destí +Keywords[cs]=Talk,Rozhovor,Oznámení,Klient,Zvuk,Odpovídání,Pošta,Volající,Banner,Předání,Určení +Keywords[cy]=siarad,cyhoeddiad,dibynnydd,swn,ateb,ebost,ymwelwr,baner,ymlaen,cyrchfan +Keywords[da]=talk,annoncering,klient,lyd,svar,post,opringer,banner,fremad,destination +Keywords[de]=Talk,Ankündigung,Client,Sound,Antwort,Mail,Banner,Forward,Weiterleitung +Keywords[el]=ομιλία,ανακοίνωση,πελάτης,ήχος,απάντηση,mail,καλών,banner,προώθηση,προορισμός +Keywords[eo]=parolo,anonco,babilo,kliento,sonoro,respondo,retpoŝto,alvokanto,flago,plusendo,celo +Keywords[es]=hablar,notificación,cliente,sonido,contestar,correo,llamador,rótulo,enviar,destino +Keywords[et]=talk,teadaanne,klient,heli,vastamine,meil,helistaja,bänner,edasisuunamine, adressaat +Keywords[eu]=elkarrizketa,berri-ematea,bezeroa,soinua,erantzungailu automatikoa,posta,deitzailea,titularra,birbidali,helburua +Keywords[fa]=گفتگو، اعلان، کارخواه، صوت، پاسخ، نامه، شمارۀ گیرنده، عنوانسازی، پیشسو، مقصد +Keywords[fi]=talk,julkistus,asiakas,ääni,vastaus,sähköposti,soittaja,mainos,uudelleenohjaa,kohde +Keywords[fr]=talk,discussion,annonce,bavardage,client,son,réponse,mail,courrier électronique,message,appel,bannière,envoi,destination +Keywords[gl]=talk,anuncio,cliente,son,resposta,correo +Keywords[he]=שיחות,הכרזה,לקוח,צליל,תשובה,דואר,מתקשר,כתובית,העברה,יעד,talk,announcement,client,sound,answering,mail,caller,banner,forward,destination +Keywords[hi]=टाक,घोषणा,क्लाएंट,ध्वनि,उत्तर,मेल,कालर,ध्वज,फारवर्ड,गंतव्य +Keywords[hu]=talk,bejelentés,kliens,hang,válasz,e-mail,hívó,üdvözlő szöveg,továbbítás,cél +Keywords[is]=talk,tilkynningar,biðlari,hljóð,svörun,svara,póstur,mail,client,sound,answering,mail,caller,banner,forward,destination +Keywords[it]=talk,annuncio,client,suono,risposte,posta,chiamante,messaggio,inoltra,destinazione +Keywords[ja]=トーク,アナウンス,クライアント,音,answering,メール,呼出側,バナー,前へ,行き先 +Keywords[km]=ជជែកគ្នា,ប្រកាស,ភ្ញៀវ,សំឡេង,ឆ្លើយឆ្លង,សំបុត្រ,អ្នកហៅ,បដា,ទៅមុខ,ទិសដៅ +Keywords[ko]=talk,announcement,client,sound,answering,mail,caller,banner,forward,destination,이야기,토크,톡,알림,알려줌,클라이언트,소리,답신,댓거리,답신,편지,부른이,콜,깃발,기,배너,전달,포워드 +Keywords[lt]=talk,announcement,client,sound,answering,mail,caller,banner,forward,destination,kalbėti,kalbėtis,pokalbis,anonsas,pranešimas,paskelbimas,panešti,paskelbti,klientas,garsas,atsakyti,atsakymas,atsiliepti,paštas,laiškas,skambintojas,skydelis,persiųsti,persiuntimas,gavėjas +Keywords[lv]=runa,paziņojums,klients,skaņa,atbildēšana,pasts,saucējs,banners,pārsūtīt,adresāts +Keywords[mk]=talk,announcement,client,sound,answering,mail,caller,banner,forward,destination,разговарање,објавување,клиент,звук,одговор,пошта,повикувач,банер,препрати,одредиште +Keywords[ms]=cakap,pengumuman,klien,bunyi,jawapan,mel,pemanggil,pemidang,destinasi,talk,announcement,client,sound,answering,mail,caller,banner,forward,destination +Keywords[mt]=talk,annunzja,announcement,client,sound,answering,mail,caller,banner,forward,destination +Keywords[nb]=talk,kunngjøring,klient,lyd,svar,post,oppringing,fane,videresend,mål +Keywords[nds]=talk,Mellen,client,Klang,antern,Antermaschien,Nettpost,Anroper,Startnaricht,wiederledden,Teel +Keywords[ne]=बोलचाल,घोषणा,क्लाइन्ट,ध्वनि,जवाफ,मेल,कलर,ब्यानर,अगाडि,गन्तब्य +Keywords[nl]=talk,aankondiging,client,sound,geluid,beantwoorden,mail,caller,banner,banier,bestemming,forward,doorsturen,destination,antwoordapparaat +Keywords[nn]=talk,kunngjering,klient,lyd,svar,post,oppringing,vidaresend,mål +Keywords[nso]=polelo,tsebiso,moreki,lesata,araba,poso,mmitsi,banner,pele,mafelelo a leeto +Keywords[pl]=rozmowa,ogłoszenie,klient,dźwięk,odpowiadanie,mail,dzwoniący,banner,podaj dalej,cel +Keywords[pt]=talk,anúncio,cliente,som,resposta,correio,chamador,mensagem,reenviar,destino +Keywords[pt_BR]=talk,anúncio,cliente,som,resposta,e-mail,correio,chamador,banner,repassar, destino +Keywords[ro]=convorbire,talk,anunţ,client,sunet,răspuns,apel,mail,apelant,apelat,înaintare,destinatar +Keywords[se]=talk,almmuheapmi,klienta,jietna,vástideapmi,boasta,sádde viidáset,ulbmil +Keywords[sk]=talk,oznámenie, klient,zvuk,odpoveď,mail,pošta,volajúci,cieľ,predať ďalej +Keywords[sl]=talk,govor,objava,odjemalec,zvok,odgovarjanje,pošta,klicatelj,reklama,posredovanje,cilj +Keywords[sr]=talk,announcement,client,sound,answering,mail,caller,banner,forward,destination,разговор,објава,клијент,звук,одговор,одговарање,пошта,позивалац,прослеђивање,одредиште +Keywords[sr@Latn]=talk,announcement,client,sound,answering,mail,caller,banner,forward,destination,razgovor,objava,klijent,zvuk,odgovor,odgovaranje,pošta,pozivalac,prosleđivanje,odredište +Keywords[sv]=talk,annonsering,klient,ljud,svar,e-post,uppringare,rubrik,vidarebefordran,destination +Keywords[ta]=பேச்சு, அறிவிப்பு, கிளையன், ஒலி, பதிலளித்தல், மின்னஞ்சல், அழைப்பு, பேனர், முன்னனுப்பு, சேருமிடம் +Keywords[tr]=talk,duyuru,istemci,Ses,cevaplama,posta,çağıran,bayrak,gönder,hedef +Keywords[uk]=розмова,оголошення,клієнт,звук,відповідь,пошта,заставка,переслати,talk,призначення +Keywords[ven]=amba,divhadza,mushumisani,mubvumo,phindulo,zwamarifhi,muvhidzi,mupandeli,phanda, vhuyo +Keywords[xh]=ncokola,isaziso,umxhasi,isandi,iyaphendula,iposi,umbizi,iceba lelaphu elinomyalezo,phambili,indawo ephelela kuyo +Keywords[zh_CN]=talk,announcement,client,sound,answering,mail,caller,banner,forward,destination,交谈,通知,客户程序,声音,应答,邮件,提示,呼叫者,转发,目标 +Keywords[zh_HK]=talk,announcement,client,sound,answering,mail,caller,banner,forward,destination,聊天,公佈,客戶端,聲音,答覆,郵件,呼叫者,目的地 +Keywords[zh_TW]=talk,announcement,client,sound,answering,mail,caller,banner,forward,destination,聊天,公佈,客戶端,聲音,答覆,郵件,呼叫者,目的地 +Keywords[zu]=khuluma,isaziso,umthengi,umsindo,iyaphendula,iposi,umbizi,ibhodi elinomyalezo,phambili,indawo ophikekelekuyo + +Categories=Qt;KDE;X-KDE-settings-network;Settings; diff --git a/ktalkd/kcmktalkd/main.cpp b/ktalkd/kcmktalkd/main.cpp new file mode 100644 index 00000000..f43fecff --- /dev/null +++ b/ktalkd/kcmktalkd/main.cpp @@ -0,0 +1,113 @@ +/* + main.cpp - The KControl module for ktalkd + + Copyright (C) 1998 by David Faure, [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 "main.h" +#include "soundpage.h" +#include "answmachpage.h" +#include "forwmachpage.h" +#include <ksimpleconfig.h> +#include <klocale.h> +#include <kglobal.h> +#include <qtabwidget.h> +#include <qlayout.h> + +KTalkdConfigModule::KTalkdConfigModule(QWidget *parent, const char *name) + : KCModule(parent, name) +{ + config = new KSimpleConfig("ktalkdrc"); + announceconfig = new KSimpleConfig("ktalkannouncerc"); + + QVBoxLayout *layout = new QVBoxLayout(this); + + tab = new QTabWidget(this); + + layout->addWidget(tab); + + soundpage = new KSoundPageConfig(this, "soundpage", config, announceconfig); + answmachpage = new KAnswmachPageConfig(this, "answmachpage", config); + forwmachpage = new KForwmachPageConfig(this, "forwmachpage", config); + + tab->addTab(soundpage, i18n("&Announcement")); + tab->addTab(answmachpage, i18n("Ans&wering Machine")); + tab->addTab(forwmachpage, i18n("forward call", "&Forward")); + + connect(soundpage, SIGNAL(changed(bool)), this, SIGNAL(changed(bool))); + connect(answmachpage, SIGNAL(changed(bool)), this, SIGNAL(changed(bool))); + connect(forwmachpage, SIGNAL(changed(bool)), this, SIGNAL(changed(bool))); + } + +KTalkdConfigModule::~KTalkdConfigModule() { + delete config; + delete announceconfig; + } + +void KTalkdConfigModule::defaults() +{ + if (soundpage) soundpage->defaults(); + if (answmachpage) answmachpage->defaults(); + if (forwmachpage) forwmachpage->defaults(); +} + +void KTalkdConfigModule::save() +{ + if (soundpage) soundpage->save(); + if (answmachpage) answmachpage->save(); + if (forwmachpage) forwmachpage->save(); +} + +void KTalkdConfigModule::load() +{ + if (soundpage) soundpage->load(); + if (answmachpage) answmachpage->load(); + if (forwmachpage) forwmachpage->load(); +} + +void KTalkdConfigModule::resizeEvent(QResizeEvent *) +{ + tab->setGeometry(0,0,width(),height()); +} + +extern "C" +{ + KDE_EXPORT KCModule *create_ktalkd(QWidget *parent, const char *) + { + return new KTalkdConfigModule(parent, "kcmktalkd"); +} + + KDE_EXPORT KCModule *create_ktalkd_answmach(QWidget *parent, const char *) +{ + return new KAnswmachPageConfig(parent, "kcmktalkd"); + } + + KDE_EXPORT KCModule *create_ktalkd_sound(QWidget *parent, const char *) + { + return new KSoundPageConfig(parent, "kcmktalkd"); + } + + KDE_EXPORT KCModule *create_ktalkd_forwmach(QWidget *parent, const char *) + { + return new KForwmachPageConfig(parent, "kcmktalkd"); + } +} + +#include "main.moc" + diff --git a/ktalkd/kcmktalkd/main.h b/ktalkd/kcmktalkd/main.h new file mode 100644 index 00000000..4b7ec823 --- /dev/null +++ b/ktalkd/kcmktalkd/main.h @@ -0,0 +1,64 @@ +/* + main.cpp - The KControl module for ktalkd + + Copyright (C) 1998 by David Faure, [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 __kcmktalkd_main_h +#define __kcmktalkd_main_h + +#include <kcmodule.h> + +class QTabWidget; + +class KSimpleConfig; + +class KSoundPageConfig; +class KAnswmachPageConfig; +class KForwmachPageConfig; + +class KTalkdConfigModule : public KCModule +{ + Q_OBJECT + +public: + + KTalkdConfigModule(QWidget *parent, const char *name); + virtual ~KTalkdConfigModule(); + + //void init(); + void load(); + void save(); + void defaults(); + +protected: + void resizeEvent(QResizeEvent *); + +private: + KSimpleConfig *config; + KSimpleConfig *announceconfig; + + QTabWidget *tab; + + KSoundPageConfig *soundpage; + KAnswmachPageConfig *answmachpage; + KForwmachPageConfig *forwmachpage; +}; + +#endif + diff --git a/ktalkd/kcmktalkd/soundpage.cpp b/ktalkd/kcmktalkd/soundpage.cpp new file mode 100644 index 00000000..bbd2431c --- /dev/null +++ b/ktalkd/kcmktalkd/soundpage.cpp @@ -0,0 +1,330 @@ +/* + * soundpage.cpp - Sound settings for KTalkd + * + * Copyright (C) 1998 David Faure, [email protected] + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * 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 "soundpage.h" +#include <config.h> + +#include <stdlib.h> //for setenv + +#include <qgroupbox.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qlistbox.h> +#include <qcheckbox.h> + +#include <klineedit.h> +#include <ksimpleconfig.h> +#include <kstandarddirs.h> +#include <klocale.h> +#include <kaudioplayer.h> +#include <kmessagebox.h> +#include <kurlrequester.h> +#include <kurldrag.h> +#include <kdialog.h> + +/* Lots of stuff taken from syssound.cpp */ + +KSoundPageConfig::KSoundPageConfig( QWidget *parent, const char* name, + KSimpleConfig *_config, KSimpleConfig *_announceconfig) + : KCModule (parent, name) +{ + if (!_config) { + delete_config = true; + config = new KSimpleConfig("ktalkdrc"); + announceconfig = new KSimpleConfig(""); + } + else { + delete_config = false; + config = _config; + announceconfig = _announceconfig; + } + + QBoxLayout* toplay = new QVBoxLayout(this, KDialog::marginHint(), + KDialog::spacingHint() ); + + QGroupBox* extprg_box = new QGroupBox(this); + extprg_box->setColumnLayout( 0, Qt::Horizontal ); + toplay->addWidget(extprg_box); + + QGridLayout* l = new QGridLayout(extprg_box->layout()); + + extprg_edit = new KURLRequester(extprg_box); + l->addWidget(extprg_edit, 2, 4); + + extprg_label = new QLabel(extprg_edit,i18n("&Announcement program:"), extprg_box); + l->addWidget(extprg_label, 2, 2); + + client_edit = new KURLRequester(extprg_box); + l->addWidget(client_edit, 4, 4); + + client_label = new QLabel(client_edit,i18n("&Talk client:"), extprg_box); + l->addWidget(client_label, 4, 2); + + toplay->addSpacing(10); + + sound_cb = new QCheckBox(i18n("&Play sound"), this); + toplay->addWidget(sound_cb); + + QGroupBox* sound_box = new QGroupBox(this); + toplay->addWidget(sound_box); + + QBoxLayout* lay = new QVBoxLayout(sound_box, 10, 10); + + int edit_h = client_edit->height(); // The height of a QLineEdit + + sound_list = new QListBox(sound_box); + sound_list->setMinimumHeight( 3 * edit_h ); + sound_list->setAcceptDrops(true); + sound_list->installEventFilter(this); + + sound_label = new QLabel(sound_list,i18n("&Sound file:"), sound_box); + lay->addWidget(sound_label); + + QBoxLayout* l2 = new QHBoxLayout(lay, 10); + l2->addWidget(sound_list); + + btn_test = new QPushButton(i18n("&Test"), sound_box); + l2->addWidget(btn_test); + + sound_tip = new QLabel( + i18n("Additional WAV files can be dropped onto the sound list."), + sound_box); + + lay->addWidget(sound_tip); + + QStringList strlist( KGlobal::dirs()->findAllResources( "sound" ) ); + sound_list->insertStringList( strlist ); + + load(); + + connect(sound_cb, SIGNAL(clicked()), this, SLOT(soundOnOff())); + connect(btn_test, SIGNAL(clicked()), this, SLOT(playCurrentSound())); + + // emit changed(true) on changes + connect(extprg_edit->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(slotChanged())); + connect(client_edit->lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(slotChanged())); +} + +KSoundPageConfig::~KSoundPageConfig( ) { + if (delete_config) { + delete config; + delete announceconfig; + } + delete extprg_label; + delete extprg_edit; + delete client_label; + delete client_edit; + delete sound_cb; + delete sound_label; + delete sound_list; + delete sound_tip; + delete btn_test; + +} + +void KSoundPageConfig::slotChanged() { + emit changed(true); +} + +bool KSoundPageConfig::eventFilter(QObject* /*o*/, QEvent* e) +{ + if (e->type() == QEvent::DragEnter) { + sound_listDragEnterEvent((QDragEnterEvent *) e); + return true; + } + + if (e->type() == QEvent::Drop) { + sound_listDropEvent((QDropEvent *) e); + return true; + } + + return false; +} + + +void KSoundPageConfig::sound_listDragEnterEvent(QDragEnterEvent* e) +{ + e->accept(KURLDrag::canDecode(e)); +} + +void KSoundPageConfig::sound_listDropEvent(QDropEvent* e){ + + KURL::List list; + // This should never happen, but anyway... + if(!KURLDrag::decode(e, list)) + return; + + // For now, we do only accept FILES ending with .wav... + for( KURL::List::ConstIterator it = list.begin(); + it != list.end(); ++it) + { + const KURL &url = *it; + + if (!url.isLocalFile()) { // for now, only file URLs are supported + + KMessageBox::sorry(this, + i18n("This type of URL is currently unsupported "\ + "by the KDE system sound module."), + i18n("Unsupported URL")); + + } + else + { // Now check for the ending ".wav" + + if (url.path().right(4).upper() != ".WAV") { + QString msg = i18n("%1\ndoes not appear "\ + "to be a WAV file.").arg(url.path()); + + KMessageBox::sorry(this, msg, i18n("Improper File Extension")); + + } + else + { // Hurra! Finally we've got a WAV file to add to the list + + if (!addToSound_List(url.path())) { + // did not add file because it is already in the list + QString msg = i18n("The file %1 is already in the list").arg(url.path()); + + KMessageBox::information(this, msg, i18n("File Already in List")); + + } + } + } + } +} + +int KSoundPageConfig::findInSound_List(QString sound) { +// Searches for <sound> in sound_list. Returns position or -1 if not found + + bool found = false; + + int i = 0; + int len = sound_list->count(); + + while ((!found) && (i < len)) { + + found = sound == sound_list->text(i); + i++; + } + return (found ? i-1 : -1); +} + +bool KSoundPageConfig::addToSound_List(QString sound){ +// Add "sound" to the sound list, but only if it is not already there + + bool found = (findInSound_List(sound) != -1); + if (!found) { // Fine, the sound is not already in the sound list! + + QString *tmp = new QString(sound); // take a copy... + sound_list->insertItem(*tmp); + sound_list->setTopItem(sound_list->count()-1); + + slotChanged(); + } + + return !found; +} + +void KSoundPageConfig::playCurrentSound() +{ + QString hlp, sname; + int soundno; + + soundno = sound_list->currentItem(); + if (soundno != -1) { + sname = sound_list->text(soundno); + if (sname[0] != '/') + KAudioPlayer::play(locate("sound", sname)); + else + KAudioPlayer::play(sname); + } +} + +void KSoundPageConfig::soundOnOff() +{ + bool b = sound_cb->isChecked(); + sound_label->setEnabled(b); + sound_list->setEnabled(b); + btn_test->setEnabled(b); + sound_tip->setEnabled(b); + + slotChanged(); +} + +void KSoundPageConfig::defaults() { + + extprg_edit->lineEdit()->setText(KStandardDirs::findExe("ktalkdlg")); + client_edit->lineEdit()->setText(KStandardDirs::findExe("konsole")+" -e talk"); + // will be ktalk when ktalk is in CVS. + sound_cb->setChecked(true); + + // Activate things according to configuration + soundOnOff(); +} + +void KSoundPageConfig::load() { + + config->setGroup("ktalkd"); + announceconfig->setGroup("ktalkannounce"); + + setenv("KDEBINDIR",QFile::encodeName(KStandardDirs::kde_default("exe")),false/*don't overwrite*/); + // for the first reading of the config file + + extprg_edit->lineEdit()->setText(config->readPathEntry("ExtPrg", + KStandardDirs::findExe("ktalkdlg"))); + client_edit->lineEdit()->setText(announceconfig->readPathEntry("talkprg", + KStandardDirs::findExe("konsole")+" -e talk")); // will be ktalk when ktalk is in CVS + + bool b = announceconfig->readBoolEntry("Sound",true/*default value*/); + sound_cb->setChecked(b); + + const QString soundFile = announceconfig->readPathEntry("SoundFile"); + if (!soundFile.isEmpty()) + { + int pos = findInSound_List(soundFile); + if (pos != -1) sound_list->setSelected(pos,true); + else { + addToSound_List(soundFile); + sound_list->setSelected(sound_list->count()-1,true); + } + } else { sound_list->setSelected(0,true); } + + // Activate things according to configuration + soundOnOff(); + + emit changed(false); +} + +void KSoundPageConfig::save() { + + config->setGroup("ktalkd"); + config->writePathEntry("ExtPrg", extprg_edit->lineEdit()->text()); + config->sync(); + announceconfig->setGroup("ktalkannounce"); + announceconfig->writePathEntry("talkprg", client_edit->lineEdit()->text()); + announceconfig->writeEntry("Sound", sound_cb->isChecked()); + announceconfig->writePathEntry("SoundFile",sound_list->text(sound_list->currentItem())); + announceconfig->sync(); +} + +#include "soundpage.moc" diff --git a/ktalkd/kcmktalkd/soundpage.h b/ktalkd/kcmktalkd/soundpage.h new file mode 100644 index 00000000..b5f713e4 --- /dev/null +++ b/ktalkd/kcmktalkd/soundpage.h @@ -0,0 +1,90 @@ +/* + * soundpage.h + * + * Copyright (c) 1998 David Faure + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * 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 __KCONTROL_KSOUNDPAGE_H__ +#define __KCONTROL_KSOUNDPAGE_H__ + +#include <qdir.h> +/* has to be before everything because of #define Unsorted 0 in X11/X.h !! */ + +#include <qobject.h> + +#include <kcmodule.h> + + +class QDragMoveEvent; +class QDragEnterEvent; +class QDropEvent; + +class KSimpleConfig; +class KURLRequester; +class QCheckBox; +class QLabel; +class QListBox; +class QPushButton; + +class KSoundPageConfig : public KCModule +{ + Q_OBJECT + +public: + KSoundPageConfig( QWidget *parent=0, const char* name=0, + KSimpleConfig *config=0, KSimpleConfig *announceconfig=0); + ~KSoundPageConfig( ); + + void load(); + void save(); + void defaults(); + + bool eventFilter(QObject* o, QEvent* e); + +private slots: + void soundOnOff(); + void playCurrentSound(); + void slotChanged(); + + // Sound DnD + void sound_listDragEnterEvent(QDragEnterEvent* e); + void sound_listDropEvent(QDropEvent* e); + +private: + KSimpleConfig *config; + KSimpleConfig *announceconfig; + bool delete_config; + + QLabel *extprg_label; + KURLRequester *extprg_edit; + QLabel *client_label; + KURLRequester *client_edit; + QCheckBox *sound_cb; + QLabel *sound_label; + QListBox *sound_list; + QLabel *sound_tip; + QPushButton *btn_test; + + int findInSound_List(QString sound); + bool addToSound_List(QString sound); +}; + +#endif + |