summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/jabber/jabberformtranslator.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
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/protocols/jabber/jabberformtranslator.cpp
downloadtdenetwork-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 'kopete/protocols/jabber/jabberformtranslator.cpp')
-rw-r--r--kopete/protocols/jabber/jabberformtranslator.cpp91
1 files changed, 91 insertions, 0 deletions
diff --git a/kopete/protocols/jabber/jabberformtranslator.cpp b/kopete/protocols/jabber/jabberformtranslator.cpp
new file mode 100644
index 00000000..fe6ec230
--- /dev/null
+++ b/kopete/protocols/jabber/jabberformtranslator.cpp
@@ -0,0 +1,91 @@
+ /*
+ * jabberformtranslator.cpp
+ *
+ * Copyright (c) 2002-2003 by Till Gerken <[email protected]>
+ *
+ * Kopete (c) by the Kopete developers <[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. *
+ * * *
+ * *************************************************************************
+ */
+
+#include <qlabel.h>
+
+#include <kdebug.h>
+
+#include "jabberformlineedit.h"
+#include "jabberformtranslator.h"
+
+JabberFormTranslator::JabberFormTranslator (const XMPP::Form & form, QWidget * parent, const char *name):QWidget (parent, name)
+{
+ /* Copy basic form values. */
+ privForm.setJid (form.jid ());
+ privForm.setInstructions (form.instructions ());
+ privForm.setKey (form.key ());
+
+ emptyForm = privForm;
+
+ /* Add instructions to layout. */
+ QVBoxLayout *innerLayout = new QVBoxLayout (this, 0, 4);
+
+ QLabel *label = new QLabel (form.instructions (), this, "InstructionLabel");
+ label->setAlignment (int (QLabel::WordBreak | QLabel::AlignVCenter));
+ label->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Fixed, true);
+ label->show ();
+
+ innerLayout->addWidget (label, 0);
+
+ QGridLayout *formLayout = new QGridLayout (innerLayout, form.count (), 2);
+
+ int row = 1;
+ XMPP::Form::const_iterator formEnd = form.end ();
+ for (XMPP::Form::const_iterator it = form.begin (); it != formEnd; ++it, ++row)
+ {
+ kdDebug (14130) << "[JabberFormTranslator] Adding field realName()==" <<
+ (*it).realName () << ", fieldName()==" << (*it).fieldName () << " to the dialog" << endl;
+
+ label = new QLabel ((*it).fieldName (), this, (*it).fieldName ().latin1 ());
+ formLayout->addWidget (label, row, 0);
+ label->show ();
+
+ QLineEdit *edit;
+ if ((*it).type() == XMPP::FormField::password)
+ {
+ edit = new JabberFormPasswordEdit((*it).type (), (*it).realName (), (*it).value (), this);
+ }
+ else
+ {
+ edit = new JabberFormLineEdit ((*it).type (), (*it).realName (),
+ (*it).value (), this);
+ }
+ formLayout->addWidget (edit, row, 1);
+ edit->show ();
+
+ connect (this, SIGNAL (gatherData (XMPP::Form &)), edit, SLOT (slotGatherData (XMPP::Form &)));
+ }
+
+ innerLayout->addStretch ();
+}
+
+XMPP::Form & JabberFormTranslator::resultData ()
+{
+ // clear form data
+ privForm = emptyForm;
+
+ // let all line edit fields write into our form
+ emit gatherData (privForm);
+
+ return privForm;
+}
+
+JabberFormTranslator::~JabberFormTranslator ()
+{
+}
+
+#include "jabberformtranslator.moc"