summaryrefslogtreecommitdiffstats
path: root/quanta/plugins/quantapluginconfig.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite9ae80694875f869892f13f4fcaf1170a00dea41 (patch)
treeaa2f8d8a217e2d376224c8d46b7397b68d35de2d /quanta/plugins/quantapluginconfig.cpp
downloadtdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.tar.gz
tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.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/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'quanta/plugins/quantapluginconfig.cpp')
-rw-r--r--quanta/plugins/quantapluginconfig.cpp94
1 files changed, 94 insertions, 0 deletions
diff --git a/quanta/plugins/quantapluginconfig.cpp b/quanta/plugins/quantapluginconfig.cpp
new file mode 100644
index 00000000..a03ffc2c
--- /dev/null
+++ b/quanta/plugins/quantapluginconfig.cpp
@@ -0,0 +1,94 @@
+/***************************************************************************
+ quantapluginconfig.cpp - description
+ -------------------
+ begin : Sat Sep 21 2002
+ copyright : (C) 2002 by Marc Britton <consume@optushome.com.au>
+ (C) 2003-2004 by Andras Mantia <amantia@kde.org>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+/* KDE INCLUDES */
+#include <kdialogbase.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+#include <kicondialog.h>
+
+/* QT INCLUDES */
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+#include <qlineedit.h>
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qcombobox.h>
+#include <qwidgetstack.h>
+
+/* OTHER INCLUDES */
+#include "quantapluginconfig.h"
+#include "quantaplugin.h"
+#include "pluginconfig.h"
+
+QuantaPluginConfig::QuantaPluginConfig(QWidget *a_parent, const char *a_name)
+ : KDialogBase(a_parent, a_name, true, i18n("Configure Plugin"), KDialogBase::Ok | KDialogBase::Cancel)
+{
+ m_pluginConfigWidget = new PluginConfig(this);
+
+ QStringList windows;
+ i18n("Message Area Tab");
+ windows << i18n("Editor Tab") << i18n("Separate Toolview");
+ m_pluginConfigWidget->outputWindow->insertStringList(windows);
+ m_pluginConfigWidget->iconButton->setStrictIconSize(false);
+
+ connect(m_pluginConfigWidget->pluginName, SIGNAL(textChanged(const QString &)), this, SLOT(nameChanged(const QString &)));
+ connect(m_pluginConfigWidget->locationButton, SIGNAL(clicked()), this, SLOT(selectLocation()));
+
+ setMainWidget(m_pluginConfigWidget);
+}
+
+QuantaPluginConfig::~QuantaPluginConfig()
+{
+}
+
+void QuantaPluginConfig::accept()
+{
+ if(m_pluginConfigWidget->validateCheckBox->isChecked())
+ {
+ bool isValid = QuantaPlugin::validatePluginInfo(m_pluginConfigWidget->pluginName->text(), m_pluginConfigWidget->location->text(), m_pluginConfigWidget->pluginFileName->text(), m_pluginConfigWidget->outputWindow->currentText());
+
+ if(!isValid)
+ {
+ int answer = KMessageBox::questionYesNo(this, i18n("The plugin information you entered appears to be invalid. Are you sure you want to apply these settings?"), i18n("Invalid Plugin"), KStdGuiItem::apply(), i18n("Do Not Apply"));
+
+ if(answer == KMessageBox::No)
+ return;
+ }
+ }
+ KDialogBase::accept();
+}
+
+/** Gets the plugin location */
+void QuantaPluginConfig::selectLocation()
+{
+ QString pluginLocation = KFileDialog::getExistingDirectory(QString::null, this, i18n("Select Plugin Folder"));
+ if(!pluginLocation.isNull())
+ {
+ m_pluginConfigWidget->location->setText(pluginLocation);
+ }
+}
+
+void QuantaPluginConfig::nameChanged(const QString &a_text)
+{
+ QString text = a_text;
+ text = "lib" + text + ".la";
+ m_pluginConfigWidget->pluginFileName->setText(text.lower());
+}
+
+#include "quantapluginconfig.moc"