• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

Kate

autobrace_config.cpp

Go to the documentation of this file.
00001 
00020 #include "autobrace_config.h"
00021 #include "autobrace.h"
00022 
00023 #include <QtGui/QBoxLayout>
00024 #include <QtGui/QCheckBox>
00025 
00026 #include <klocale.h>
00027 #include <kpluginfactory.h>
00028 #include <kpluginloader.h>
00029 #include <klineedit.h>
00030 #include <kconfiggroup.h>
00031 
00032 AutoBraceConfig::AutoBraceConfig(QWidget *parent, const QVariantList &args)
00033     : KCModule(AutoBracePluginFactory::componentData(), parent, args)
00034 {
00035     QVBoxLayout *layout = new QVBoxLayout(this);
00036 
00037     m_autoBrackets = new QCheckBox(i18n("Automatically add closing brackets ) and ]"), this);
00038     m_autoQuotations = new QCheckBox(i18n("Automatically add closing quotation marks"), this);
00039 
00040     layout->addWidget(m_autoBrackets);
00041     layout->addWidget(m_autoQuotations);
00042 
00043     setLayout(layout);
00044 
00045     load();
00046 
00047     // Changed slots
00048     connect(m_autoBrackets, SIGNAL(toggled(bool)), this, SLOT(slotChanged(bool)));
00049     connect(m_autoQuotations, SIGNAL(toggled(bool)), this, SLOT(slotChanged(bool)));
00050 }
00051 
00052 AutoBraceConfig::~AutoBraceConfig()
00053 {
00054 }
00055 
00056 void AutoBraceConfig::save()
00057 {
00058     if (AutoBracePlugin::self())
00059     {
00060         AutoBracePlugin::self()->setAutoBrackets(m_autoBrackets->isChecked());
00061         AutoBracePlugin::self()->setAutoQuotations(m_autoQuotations->isChecked());
00062         AutoBracePlugin::self()->writeConfig();
00063     }
00064     else
00065     {
00066         KConfigGroup cg(KGlobal::config(), "AutoBrace Plugin");
00067         cg.writeEntry("autobrackets", m_autoBrackets->isChecked());
00068         cg.writeEntry("autoquotations", m_autoQuotations->isChecked());
00069     }
00070 
00071     emit changed(false);
00072 }
00073 
00074 void AutoBraceConfig::load()
00075 {
00076     if (AutoBracePlugin::self())
00077     {
00078         AutoBracePlugin::self()->readConfig();
00079         m_autoBrackets->setChecked(AutoBracePlugin::self()->autoBrackets());
00080         m_autoQuotations->setChecked(AutoBracePlugin::self()->autoQuotations());
00081     }
00082     else
00083     {
00084         KConfigGroup cg(KGlobal::config(), "AutoBrace Plugin" );
00085         m_autoBrackets->setChecked(cg.readEntry("autobrackets", QVariant(true)).toBool());
00086         m_autoQuotations->setChecked(cg.readEntry("autoquotations", QVariant(true)).toBool());
00087     }
00088 
00089     emit changed(false);
00090 }
00091 
00092 void AutoBraceConfig::defaults()
00093 {
00094     m_autoBrackets->setChecked(true);
00095     m_autoQuotations->setChecked(true);
00096 
00097     emit changed(true);
00098 }
00099 
00100 void AutoBraceConfig::slotChanged(bool)
00101 {
00102     emit changed(true);
00103 }
00104 
00105 #include "autobrace_config.moc"
00106 

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal