summaryrefslogtreecommitdiffstats
path: root/konq-plugins/validators
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
commit84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch)
tree2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /konq-plugins/validators
downloadtdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz
tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.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/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/validators')
-rw-r--r--konq-plugins/validators/Makefile.am24
-rw-r--r--konq-plugins/validators/cr16-action-cssvalidator.pngbin0 -> 746 bytes
-rw-r--r--konq-plugins/validators/cr16-action-htmlvalidator.pngbin0 -> 631 bytes
-rw-r--r--konq-plugins/validators/cr16-action-validators.pngbin0 -> 631 bytes
-rw-r--r--konq-plugins/validators/cr22-action-cssvalidator.pngbin0 -> 1125 bytes
-rw-r--r--konq-plugins/validators/cr22-action-htmlvalidator.pngbin0 -> 999 bytes
-rw-r--r--konq-plugins/validators/cr22-action-validators.pngbin0 -> 999 bytes
-rw-r--r--konq-plugins/validators/plugin_validators.cpp202
-rw-r--r--konq-plugins/validators/plugin_validators.desktop128
-rw-r--r--konq-plugins/validators/plugin_validators.h72
-rw-r--r--konq-plugins/validators/plugin_validators.rc11
-rw-r--r--konq-plugins/validators/validatorsdialog.cpp176
-rw-r--r--konq-plugins/validators/validatorsdialog.h58
13 files changed, 671 insertions, 0 deletions
diff --git a/konq-plugins/validators/Makefile.am b/konq-plugins/validators/Makefile.am
new file mode 100644
index 0000000..3c09508
--- /dev/null
+++ b/konq-plugins/validators/Makefile.am
@@ -0,0 +1,24 @@
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = libvalidatorsplugin.la
+
+libvalidatorsplugin_la_SOURCES = plugin_validators.cpp validatorsdialog.cpp
+libvalidatorsplugin_la_LIBADD = $(LIB_KPARTS) $(LIB_KHTML)
+libvalidatorsplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+
+pluginsdir = $(kde_datadir)/khtml/kpartplugins
+plugins_DATA = plugin_validators.rc plugin_validators.desktop
+
+appsdir = $(kde_appsdir)/.hidden
+apps_DATA = plugin_validators.desktop
+
+install-data-local: $(srcdir)/../uninstall.desktop
+ $(mkinstalldirs) $(DESTDIR)$(pluginsdir)
+ $(INSTALL_DATA) $(srcdir)/../uninstall.desktop $(DESTDIR)$(pluginsdir)/validatorsplugin.desktop
+
+KDE_ICON = validators cssvalidator htmlvalidator
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp *.h -o $(podir)/validatorsplugin.pot
diff --git a/konq-plugins/validators/cr16-action-cssvalidator.png b/konq-plugins/validators/cr16-action-cssvalidator.png
new file mode 100644
index 0000000..63bbee6
--- /dev/null
+++ b/konq-plugins/validators/cr16-action-cssvalidator.png
Binary files differ
diff --git a/konq-plugins/validators/cr16-action-htmlvalidator.png b/konq-plugins/validators/cr16-action-htmlvalidator.png
new file mode 100644
index 0000000..b4a0acc
--- /dev/null
+++ b/konq-plugins/validators/cr16-action-htmlvalidator.png
Binary files differ
diff --git a/konq-plugins/validators/cr16-action-validators.png b/konq-plugins/validators/cr16-action-validators.png
new file mode 100644
index 0000000..b4a0acc
--- /dev/null
+++ b/konq-plugins/validators/cr16-action-validators.png
Binary files differ
diff --git a/konq-plugins/validators/cr22-action-cssvalidator.png b/konq-plugins/validators/cr22-action-cssvalidator.png
new file mode 100644
index 0000000..a6dec2b
--- /dev/null
+++ b/konq-plugins/validators/cr22-action-cssvalidator.png
Binary files differ
diff --git a/konq-plugins/validators/cr22-action-htmlvalidator.png b/konq-plugins/validators/cr22-action-htmlvalidator.png
new file mode 100644
index 0000000..ff67d1e
--- /dev/null
+++ b/konq-plugins/validators/cr22-action-htmlvalidator.png
Binary files differ
diff --git a/konq-plugins/validators/cr22-action-validators.png b/konq-plugins/validators/cr22-action-validators.png
new file mode 100644
index 0000000..ff67d1e
--- /dev/null
+++ b/konq-plugins/validators/cr22-action-validators.png
Binary files differ
diff --git a/konq-plugins/validators/plugin_validators.cpp b/konq-plugins/validators/plugin_validators.cpp
new file mode 100644
index 0000000..69f07cd
--- /dev/null
+++ b/konq-plugins/validators/plugin_validators.cpp
@@ -0,0 +1,202 @@
+/* This file is part of Validators
+ *
+ * It's a merge of the HTML- and the CSSValidator
+ *
+ * Copyright (C) 2001 by Richard Moore <rich@kde.org>
+ * Andreas Schlapbach <schlpbch@iam.unibe.ch>
+ *
+ * for information how to write your own plugin see:
+ * http://developer.kde.org/documentation/tutorials/dot/writing-plugins.html
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+/* $Id$ */
+
+#include <kinstance.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+#include <kaction.h>
+#include <khtml_part.h>
+#include <kgenericfactory.h>
+#include <kdebug.h>
+#include <kaboutdata.h>
+
+#include "plugin_validators.h"
+#include "validatorsdialog.h"
+
+
+typedef KGenericFactory<PluginValidators> PluginValidatorsFactory;
+static const KAboutData aboutdata("validatorsplugin", I18N_NOOP("Validate Web Page") , "1.0" );
+K_EXPORT_COMPONENT_FACTORY( libvalidatorsplugin,
+ PluginValidatorsFactory( &aboutdata ) )
+
+PluginValidators::PluginValidators( QObject* parent, const char* name,
+ const QStringList & )
+ : Plugin( parent, name ), m_configDialog(0), m_part(0)
+{
+ setInstance(PluginValidatorsFactory::instance());
+
+ m_menu = new KActionMenu ( i18n( "&Validate Web Page" ), "validators",
+ actionCollection(), "validateWebpage" );
+ m_menu->setDelayed( false );
+
+ m_menu->insert( new KAction( i18n( "Validate &HTML" ),
+ "htmlvalidator", 0,
+ this, SLOT(slotValidateHTML()),
+ actionCollection(), "validateHTML") );
+
+ m_menu->insert( new KAction( i18n( "Validate &CSS" ),
+ "cssvalidator", 0,
+ this, SLOT(slotValidateCSS()),
+ actionCollection(), "validateCSS") );
+
+ m_menu->insert( new KAction( i18n( "Validate &Links" ),
+ 0,
+ this, SLOT(slotValidateLinks()),
+ actionCollection(), "validateLinks") );
+
+ m_menu->setEnabled( false );
+
+ if ( parent && parent->inherits( "KHTMLPart" ))
+ {
+ m_menu->insert( new KAction( i18n( "C&onfigure Validator..." ),
+ "configure", 0,
+ this, SLOT(slotConfigure()),
+ actionCollection(), "configure") );
+
+ m_part = static_cast<KHTMLPart *>( parent );
+ m_configDialog = new ValidatorsDialog( m_part->widget() );
+ setURLs();
+
+ connect( m_part, SIGNAL(started(KIO::Job*)), this,
+ SLOT(slotStarted(KIO::Job*)) );
+ }
+}
+
+PluginValidators::~PluginValidators()
+{
+ delete m_configDialog;
+// Dont' delete the action. KActionCollection as parent does the job already
+// and not deleting it at this point also ensures that in case we are not unplugged
+// from the GUI yet and the ~KXMLGUIClient destructor will do so it won't hit a
+// dead pointer. The kxmlgui factory keeps references to the actions, but it does not
+// connect to their destroyed() signal, yet (need to find an elegant solution for that
+// as it can easily increase the memory usage significantly) . That's why actions must
+// persist as long as the plugin is plugged into the GUI.
+// delete m_menu;
+}
+
+void PluginValidators::setURLs()
+{
+ m_WWWValidatorUrl = KURL(m_configDialog->getWWWValidatorUrl());
+ m_CSSValidatorUrl = KURL(m_configDialog->getCSSValidatorUrl());
+ m_WWWValidatorUploadUrl = KURL(m_configDialog->getWWWValidatorUploadUrl());
+ m_CSSValidatorUploadUrl = KURL(m_configDialog->getCSSValidatorUploadUrl());
+ m_linkValidatorUrl = KURL(m_configDialog->getLinkValidatorUrl());
+}
+
+void PluginValidators::slotStarted( KIO::Job* )
+{
+ // The w3c validator can only access http URLs, and upload local files.
+ // No https, probably no webdav either.
+ m_menu->setEnabled( m_part->url().isLocalFile()
+ || m_part->url().protocol().lower() == "http" );
+}
+
+void PluginValidators::slotValidateHTML()
+{
+ validateURL(m_WWWValidatorUrl, m_WWWValidatorUploadUrl);
+}
+
+void PluginValidators::slotValidateCSS()
+{
+ validateURL(m_CSSValidatorUrl, m_CSSValidatorUploadUrl);
+}
+
+void PluginValidators::slotValidateLinks()
+{
+ validateURL(m_linkValidatorUrl, KURL());
+}
+
+void PluginValidators::slotConfigure()
+{
+ m_configDialog->show();
+ setURLs();
+}
+
+void PluginValidators::validateURL(const KURL &url, const KURL &uploadUrl)
+{
+ // The parent is assumed to be a KHTMLPart
+ if ( !parent()->inherits("KHTMLPart") )
+ {
+ QString title = i18n( "Cannot Validate Source" );
+ QString text = i18n( "You cannot validate anything except web pages with "
+ "this plugin." );
+
+ KMessageBox::sorry( 0, text, title );
+ return;
+ }
+
+ KURL validatorUrl(url);
+
+ // Get URL
+ KURL partUrl = m_part->url();
+ if ( !partUrl.isValid() ) // Just in case ;)
+ {
+ QString title = i18n( "Malformed URL" );
+ QString text = i18n( "The URL you entered is not valid, please "
+ "correct it and try again." );
+ KMessageBox::sorry( 0, text, title );
+ return;
+ }
+
+ if (partUrl.isLocalFile())
+ {
+ if ( validatorUrl.isEmpty() ) {
+ QString title = i18n( "Upload Not Possible" );
+ QString text = i18n( "Validating links is not possible for local "
+ "files." );
+ KMessageBox::sorry( 0, text, title );
+ return;
+ }
+ validatorUrl = uploadUrl;
+ }
+ else
+ {
+ if (partUrl.hasPass())
+ {
+ KMessageBox::sorry(
+ m_part->widget(),
+ i18n("<qt>The selected URL cannot be verified because it contains "
+ "a password. Sending this URL to <b>%1</b> would put the security "
+ "of <b>%2</b> at risk.</qt>")
+ .arg(validatorUrl.host()).arg(partUrl.host()));
+ return;
+ }
+ // Set entered URL as a parameter
+ QString q = partUrl.url();
+ q = KURL::encode_string( q );
+ QString p = "uri=";
+ p += q;
+ validatorUrl.setQuery( p );
+ }
+ kdDebug(90120) << "final URL: " << validatorUrl.url() << endl;
+
+ emit m_part->browserExtension()->openURLRequest( validatorUrl );
+}
+
+#include <plugin_validators.moc>
diff --git a/konq-plugins/validators/plugin_validators.desktop b/konq-plugins/validators/plugin_validators.desktop
new file mode 100644
index 0000000..f326863
--- /dev/null
+++ b/konq-plugins/validators/plugin_validators.desktop
@@ -0,0 +1,128 @@
+[Desktop Entry]
+X-KDE-Library=validators
+X-KDE-PluginInfo-Author=Richard Moore, Andreas Schlapbach
+X-KDE-PluginInfo-Email=rich@kde.org, schlpbch@iam.unibe.ch
+X-KDE-PluginInfo-Name=validators
+X-KDE-PluginInfo-Version=3.3
+X-KDE-PluginInfo-Website=
+X-KDE-PluginInfo-Category=Tools
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=false
+Name=Website Validators
+Name[bg]=Валидатори за уеб сайтове
+Name[bs]=Validatori za Web stranice
+Name[ca]=Validadors de pàgines web
+Name[cs]=Validátory webových stránek
+Name[da]=Gyldighedstjekkere af netsider
+Name[de]=Webseiten-Überprüfung
+Name[el]=Ελεγκτές εγκυρότητας ιστοσελίδων
+Name[eo]=Retsituo kontroliloj
+Name[es]=Validadores de sitios web
+Name[et]=Veebilehe süntaksi kontrollijad
+Name[eu]=Weblekuen balidatzailea
+Name[fa]=اعتبارسنجهای وب‌گاه
+Name[fi]=WWW-validaattorit
+Name[fr]=Validateur de sites Internet
+Name[fy]=Webstee-falidaasjeprogramma
+Name[ga]=Bailíochtóirí Suímh Ghréasáin
+Name[gl]=Validación de Páxinas Web
+Name[he]=מוודאי אתרי אינטרנט
+Name[hi]=वेबसाइट वेलिडेटर्स
+Name[hr]=Provjera valjanosti web-lokacije
+Name[hu]=Weboldal-ellenőrző
+Name[is]=Villuleitun vefa
+Name[it]=Validatore di Siti Web
+Name[ja]=ウェブサイト検証
+Name[ka]=ვებგვერდის დამმოწმებელი
+Name[kk]=Вебсайт тексергіші
+Name[km]=កម្មវិធី​ធ្វើ​ឲ្យ​តំបន់​បណ្ដាញ​មាន​សុពលភាព
+Name[lt]=Web sričių tikrinimo priemonės
+Name[mk]=Валидатори на веб-страници
+Name[ms]=Pengesah Laman Web
+Name[nb]=Nettsted-validator
+Name[nds]=Nettsieden-Prööv
+Name[ne]=वेबसाइट प्रमाणितकर्ता
+Name[nl]=Website-validatieprogramma
+Name[nn]=Nettstadvalidering
+Name[pl]=Sprawdzanie poprawności witryn internetowych
+Name[pt]=Validação de Páginas Web
+Name[pt_BR]=Validadores de Sites Web
+Name[ru]=Проверка правильности сайтов
+Name[sk]=Kontrola web stránky
+Name[sl]=Potrdilniki spletnih strani
+Name[sr]=Оверивачи веб сајтова
+Name[sr@Latn]=Overivači veb sajtova
+Name[sv]=Validering av webbplatser
+Name[ta]=வலைதள மதிப்பீடுகள்
+Name[tg]=Тафтиши дурустии сайтҳо
+Name[tr]=İnternet Sitesi Denetleyicisi
+Name[uk]=Служби перевірки сайтів
+Name[uz]=Veb-sahifa toʻgʻriligini tekshirish
+Name[uz@cyrillic]=Веб-саҳифа тўғрилигини текшириш
+Name[vi]=Bộ thẩm tra chỗ Mạng
+Name[zh_CN]=网站校验器
+Name[zh_TW]=網站驗證器
+Comment=CSS and HTML validator plugins
+Comment[af]=Css en Html geldighiedstoetser inprop modules
+Comment[ar]=ملحقات للتأكد من صلاحية ملفات HTML و CSS
+Comment[az]=CSS və HTML doğrulayıcı əlavələri
+Comment[bg]=Приставка за валидиране на CSS и HTML
+Comment[bs]=CSS i HTML validator dodaci
+Comment[ca]=Connectors de validació CSS i HTML
+Comment[cs]=Moduly pro validaci CSS a HTML
+Comment[cy]=Ategynnau dilysydd CSS a HTML
+Comment[da]=Gyldighedstjekker-plugin for CSS og HTML
+Comment[de]=CSS- und HTML-Module zur Syntaxüberprüfung
+Comment[el]=Πρόσθετα ελέγχου εγκυρότητας CSS και HTML
+Comment[eo]=CSS kaj HTML kontrolaj kromaĵoj
+Comment[es]=Complementos para validar CSS y HTML
+Comment[et]=CSS ja HTML süntaksi kontrollimise plugin
+Comment[eu]=CSS eta HTML balidatzeko pluginak
+Comment[fa]=وصله‌های اعتبارسنج زنگام و CSS
+Comment[fi]=CSS ja HTML validointisovelmat
+Comment[fr]=Module de validation CSS et HTML
+Comment[fy]=Plugins foar it falidearjen fan HTML en CSS
+Comment[ga]=Breiseáin Bhailíochtaithe CSS agus HTML
+Comment[gl]=Plugins de validación de CSS e HTML
+Comment[he]=תוספים לווידוא CSS ו־HTML
+Comment[hi]=सीएसएस तथा एचटीएमएल वेलिडेटर प्लगइन्स
+Comment[hr]=Dodatak za provjeravanje valjanosti CSS-a i HTML-a
+Comment[hu]=CSS- és HTML-ellenőrző bővítőmodul
+Comment[is]=CSS og HTML gildir
+Comment[it]=Plugin per validare CSS e HTML
+Comment[ja]=CSS と HTML を検証するプラグイン
+Comment[ka]=CSS და HTML დამოწმების მოდული
+Comment[kk]=CSS және HTML тексергіш плагин модулі
+Comment[km]=កម្មវិធី​ជំនួយ​​របស់​កម្មវិធី​​ធ្វើ​ឲ្យ​ CSS និង​ HTML មាន​សុពលភាព
+Comment[lt]=CSS ir HTML tikrinimo priedai
+Comment[mk]=Приклучоци за валидирање на CSS и HTML
+Comment[ms]=Plugin pengesah CSS dan HTML
+Comment[nb]=Tilleggsmoduler for validering av CSS og HTML
+Comment[nds]=CSS- un HTML-Pröövmodulen
+Comment[ne]=सीएसएस र एचटीएमएल प्रमाणितकर्ता प्लगइनहरू
+Comment[nl]=Plugins voor het valideren van HTML en CSS
+Comment[nn]=Programtillegg for validering av CSS og HTML
+Comment[pl]=Wtyczka sprawdzania poprawności HTML i CSS
+Comment[pt]='Plugins' de validação de CSS e HTML
+Comment[pt_BR]=Plug-Ins validador para CSS e HTML
+Comment[ro]=Module de validare CSS şi HTML
+Comment[ru]=Модули проверки правильности HTML и CSS
+Comment[sk]=Modul pre kontrolu CSS a HTML
+Comment[sl]=Vstavki za potrjevanje CSS in HTML
+Comment[sr]=Прикључци за оверавање CSS-а и HTML-а
+Comment[sr@Latn]=Priključci za overavanje CSS-a i HTML-a
+Comment[sv]=Insticksprogram för CSS- och HTML-validering
+Comment[ta]=CSS மற்றும் HTML மதிப்பீட்டாளர் சொருகுப்பொருள்கள்
+Comment[tg]=Модули тафтиши дурустии HTML ва CSS
+Comment[tr]=CSS ve HTML denetleme eklentileri
+Comment[uk]=Втулки перевірки CSS і HTML
+Comment[uz]=HTML va CSS toʻgʻriligini tekshirish vositalari
+Comment[uz@cyrillic]=HTML ва CSS тўғрилигини текшириш воситалари
+Comment[vi]=Bổ sung thẩm tra HTML và CSS
+Comment[xh]=Iiplagi zangaphakathi zomqinisekisi we CSS ne HTML
+Comment[zh_CN]=CSS 和 HTML 校验插件
+Comment[zh_TW]=CSS 與 HTML 驗證外掛程式
+Icon=validators
+X-KDE-ParentApp=konqueror
+DocPath=konq-plugins/validators/index.html
diff --git a/konq-plugins/validators/plugin_validators.h b/konq-plugins/validators/plugin_validators.h
new file mode 100644
index 0000000..448e77f
--- /dev/null
+++ b/konq-plugins/validators/plugin_validators.h
@@ -0,0 +1,72 @@
+/* This file is part of Validators
+ *
+ * It's a merge of the HTML- and the CSSValidator
+ *
+ * Copyright (C) 2001 by Richard Moore <rich@kde.org>
+ * Andreas Schlapbach <schlpbch@iam.unibe.ch>
+ *
+ * for information how to write your own plugin see:
+ * http://developer.kde.org/documentation/tutorials/dot/writing-plugins.html
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+/* $Id$ */
+
+#ifndef __plugin_validators_h
+#define __plugin_validators_h
+
+#include <kparts/plugin.h>
+#include <klibloader.h>
+
+#include "validatorsdialog.h"
+#include <qguardedptr.h>
+
+class KAction;
+class KURL;
+
+class PluginValidators : public KParts::Plugin
+{
+ Q_OBJECT
+public:
+ PluginValidators( QObject* parent, const char* name,
+ const QStringList & );
+ virtual ~PluginValidators();
+
+public slots:
+ void slotValidateHTML();
+ void slotValidateCSS();
+ void slotValidateLinks();
+ void slotConfigure();
+
+private slots:
+ void slotStarted( KIO::Job* );
+
+private:
+ KActionMenu *m_menu;
+ QGuardedPtr<ValidatorsDialog> m_configDialog; // |
+ // +-> Order dependency.
+ KHTMLPart* m_part; // |
+
+ KURL m_WWWValidatorUrl, m_WWWValidatorUploadUrl;
+ KURL m_CSSValidatorUrl, m_CSSValidatorUploadUrl;
+ KURL m_linkValidatorUrl;
+
+ void setURLs();
+ void validateURL(const KURL &url, const KURL &uploadUrl = KURL());
+};
+
+#endif
diff --git a/konq-plugins/validators/plugin_validators.rc b/konq-plugins/validators/plugin_validators.rc
new file mode 100644
index 0000000..5207ee8
--- /dev/null
+++ b/konq-plugins/validators/plugin_validators.rc
@@ -0,0 +1,11 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="validators" library="libvalidatorsplugin">
+<MenuBar>
+ <Menu name="tools"><Text>&amp;Tools</Text>
+ <Action name="validateWebpage"/>
+ </Menu>
+</MenuBar>
+<ToolBar name="extraToolBar"><text>Extra Toolbar</text>
+ <Action name="validateWebpage"/>
+</ToolBar>
+</kpartplugin>
diff --git a/konq-plugins/validators/validatorsdialog.cpp b/konq-plugins/validators/validatorsdialog.cpp
new file mode 100644
index 0000000..0c524e2
--- /dev/null
+++ b/konq-plugins/validators/validatorsdialog.cpp
@@ -0,0 +1,176 @@
+/* This file is part of the KDE project
+
+ Copyright (C) 2001 Andreas Schlapbach <schlpbch@iam.unibe.ch>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <qlabel.h>
+#include <qvbox.h>
+#include <qgroupbox.h>
+#include <qlayout.h>
+#include <qcombobox.h>
+#include <kconfig.h>
+
+#include <klocale.h>
+
+#include "validatorsdialog.h"
+#include "validatorsdialog.moc"
+
+ValidatorsDialog::ValidatorsDialog(QWidget *parent, const char *name )
+ : KDialogBase( parent, name, false, i18n("Configure"), Ok|Cancel, Ok, true )
+{
+ setCaption(i18n("Configure Validating Servers"));
+ setMinimumWidth(300);
+
+ QVBox *page = makeVBoxMainWidget ();
+
+ QGroupBox *tgroup = new QGroupBox( i18n("HTML/XML Validator"), page );
+ QVBoxLayout *vlay = new QVBoxLayout( tgroup, spacingHint() );
+ vlay->addSpacing( fontMetrics().lineSpacing());
+
+ vlay->addWidget(new QLabel( i18n("URL:"), tgroup));
+
+ m_WWWValidatorCB = new QComboBox(true, tgroup);
+ m_WWWValidatorCB->setDuplicatesEnabled(false);
+ vlay->addWidget( m_WWWValidatorCB );
+
+ vlay->addWidget(new QLabel( i18n("Upload:"), tgroup));
+
+ m_WWWValidatorUploadCB = new QComboBox(true, tgroup);
+ m_WWWValidatorUploadCB->setDuplicatesEnabled(false);
+ vlay->addWidget( m_WWWValidatorUploadCB );
+
+ ///
+
+ QGroupBox *group2= new QGroupBox( i18n("CSS Validator"), page );
+ QVBoxLayout *vlay2 = new QVBoxLayout( group2, spacingHint() );
+ vlay2->addSpacing( fontMetrics().lineSpacing());
+
+ vlay2->addWidget(new QLabel( i18n("URL:"), group2));
+
+ m_CSSValidatorCB = new QComboBox(true, group2);
+ m_CSSValidatorCB->setDuplicatesEnabled(false);
+ vlay2->addWidget( m_CSSValidatorCB );
+
+ vlay2->addWidget(new QLabel( i18n("Upload:"), group2));
+
+ m_CSSValidatorUploadCB = new QComboBox(true, group2);
+ m_CSSValidatorUploadCB->setDuplicatesEnabled(false);
+ vlay2->addWidget( m_CSSValidatorUploadCB );
+
+ ///
+
+ QGroupBox *group3= new QGroupBox( i18n("Link Validator"), page );
+ QVBoxLayout *vlay3 = new QVBoxLayout( group3, spacingHint() );
+ vlay3->addSpacing( fontMetrics().lineSpacing());
+
+ vlay3->addWidget(new QLabel( i18n("URL:"), group3));
+
+ m_linkValidatorCB = new QComboBox(true, group3);
+ m_linkValidatorCB->setDuplicatesEnabled(false);
+ vlay3->addWidget( m_linkValidatorCB );
+
+ load();
+}
+
+ValidatorsDialog::~ValidatorsDialog()
+{
+ delete m_config;
+}
+
+void ValidatorsDialog::load()
+{
+ m_config = new KConfig("validatorsrc");
+ m_config->setGroup("Addresses");
+
+ m_WWWValidatorCB->insertStringList(m_config->readListEntry("WWWValidatorUrl"));
+ if (m_WWWValidatorCB->count()==0) {
+ m_WWWValidatorCB->insertItem("http://validator.w3.org/check");
+ }
+ m_WWWValidatorCB->setCurrentItem(m_config->readNumEntry("WWWValidatorUrlIndex",0));
+
+ m_CSSValidatorCB->insertStringList(m_config->readListEntry("CSSValidatorUrl"));
+ if (m_CSSValidatorCB->count()==0) {
+ m_CSSValidatorCB->insertItem("http://jigsaw.w3.org/css-validator/validator");
+ }
+ m_CSSValidatorCB->setCurrentItem(m_config->readNumEntry("CSSValidatorUrlIndex",0));
+
+ m_linkValidatorCB->insertStringList(m_config->readListEntry("LinkValidatorUrl"));
+ if (m_linkValidatorCB->count()==0) {
+ m_linkValidatorCB->insertItem("http://validator.w3.org/checklink");
+ }
+ m_linkValidatorCB->setCurrentItem(m_config->readNumEntry("LinkValidatorUrlIndex",0));
+
+ m_WWWValidatorUploadCB->insertStringList(m_config->readListEntry("WWWValidatorUploadUrl"));
+ if (m_WWWValidatorUploadCB->count()==0) {
+ m_WWWValidatorUploadCB->insertItem("http://validator.w3.org/file-upload.html");
+ }
+ m_WWWValidatorUploadCB->setCurrentItem(m_config->readNumEntry("WWWValidatorUploadUrlIndex",0));
+
+ m_CSSValidatorUploadCB->insertStringList(m_config->readListEntry("CSSValidatorUploadUrl"));
+ if (m_CSSValidatorUploadCB->count()==0) {
+ m_CSSValidatorUploadCB->insertItem("http://jigsaw.w3.org/css-validator/validator-upload.html" );
+ }
+ m_CSSValidatorUploadCB->setCurrentItem(m_config->readNumEntry("CSSValidatorUploadUrlIndex",0));
+}
+
+void ValidatorsDialog::save()
+{
+ QStringList strList;
+ for (int i = 0; i < m_WWWValidatorCB->count(); i++) {
+ strList.append(m_WWWValidatorCB->text(i));
+ }
+ m_config->writeEntry( "WWWValidatorUrl", strList );
+ strList.clear();
+ for (int i = 0; i < m_CSSValidatorCB->count(); i++) {
+ strList.append(m_CSSValidatorCB->text(i));
+ }
+ m_config->writeEntry( "CSSValidatorUrl", strList );
+ strList.clear();
+ for (int i = 0; i < m_linkValidatorCB->count(); i++) {
+ strList.append(m_linkValidatorCB->text(i));
+ }
+ m_config->writeEntry( "LinkValidatorUrl", strList );
+ strList.clear();
+ for (int i = 0; i < m_WWWValidatorUploadCB->count(); i++) {
+ strList.append(m_WWWValidatorUploadCB->text(i));
+ }
+ m_config->writeEntry( "WWWValidatorUploadUrl", strList );
+ strList.clear();
+ for (int i = 0; i < m_CSSValidatorUploadCB->count(); i++) {
+ strList.append(m_CSSValidatorUploadCB->text(i));
+ }
+ m_config->writeEntry( "CSSValidatorUploadUrl", strList );
+
+ m_config->writeEntry( "WWWValidatorUrlIndex", m_WWWValidatorCB->currentItem() );
+ m_config->writeEntry( "CSSValidatorUrlIndex", m_CSSValidatorCB->currentItem() );
+ m_config->writeEntry( "LinkValidatorUrlIndex", m_linkValidatorCB->currentItem() );
+ m_config->writeEntry( "WWWValidatorUploadUrlIndex", m_WWWValidatorUploadCB->currentItem() );
+ m_config->writeEntry( "CSSValidatorUploadUrlIndex", m_CSSValidatorUploadCB->currentItem() );
+ m_config->sync();
+}
+
+void ValidatorsDialog::slotOk()
+{
+ save();
+ hide();
+}
+
+void ValidatorsDialog::slotCancel()
+{
+ load();
+ hide();
+}
diff --git a/konq-plugins/validators/validatorsdialog.h b/konq-plugins/validators/validatorsdialog.h
new file mode 100644
index 0000000..79684f5
--- /dev/null
+++ b/konq-plugins/validators/validatorsdialog.h
@@ -0,0 +1,58 @@
+/* This file is part of the KDE project
+
+ Copyright (C) 2001 Andreas Schlapbach <schlpbch@iam.unibe.ch>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef __validatorsdialog_h
+#define __validatorsdialog_h
+
+#include <qcombobox.h>
+
+#include <kconfig.h>
+#include <kdialogbase.h>
+
+class ValidatorsDialog : public KDialogBase
+{
+ Q_OBJECT
+
+ public:
+ ValidatorsDialog(QWidget *parent=0, const char *name=0 );
+ ~ValidatorsDialog();
+
+ const QString getWWWValidatorUrl() const {return m_WWWValidatorCB->currentText();}
+ const QString getCSSValidatorUrl() const {return m_CSSValidatorCB->currentText();}
+ const QString getWWWValidatorUploadUrl() const {return m_WWWValidatorUploadCB->currentText();}
+ const QString getCSSValidatorUploadUrl() const {return m_CSSValidatorUploadCB->currentText();}
+ const QString getLinkValidatorUrl() const {return m_linkValidatorCB->currentText();}
+
+ protected slots:
+ void slotOk();
+ void slotCancel();
+
+ private:
+ void load();
+ void save();
+
+ QComboBox *m_WWWValidatorCB;
+ QComboBox *m_WWWValidatorUploadCB;
+ QComboBox *m_CSSValidatorCB;
+ QComboBox *m_CSSValidatorUploadCB;
+ QComboBox *m_linkValidatorCB;
+ KConfig *m_config;
+};
+
+#endif