• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Kate

timedate_config.cpp

Go to the documentation of this file.
00001 
00020 #include "timedate_config.h"
00021 #include "timedate.h"
00022 
00023 #include <QtGui/QLabel>
00024 #include <QtGui/QBoxLayout>
00025 
00026 #include <klocale.h>
00027 #include <kpluginfactory.h>
00028 #include <kpluginloader.h>
00029 #include <klineedit.h>
00030 #include <kconfiggroup.h>
00031 
00032 TimeDateConfig::TimeDateConfig(QWidget *parent, const QVariantList &args)
00033     : KCModule(TimeDatePluginFactory::componentData(), parent, args)
00034 {
00035     QVBoxLayout *layout = new QVBoxLayout(this);
00036 
00037     QLabel *info = new QLabel(i18n(
00038      "%y\t2-digit year excluding century (00 - 99)\n"
00039      "%Y\tfull year number\n"
00040      "%:m\tmonth number, without leading zero (1 - 12)\n"
00041      "%m\tmonth number, 2 digits (01 - 12)\n"
00042      "%b\tabbreviated month name\n"
00043      "%B\tfull month name\n"
00044      "%e\tday of the month (1 - 31)\n"
00045      "%d\tday of the month, 2 digits (01 - 31)\n"
00046      "%a\tabbreviated weekday name\n"
00047      "%A\tfull weekday name\n"
00048      "\n"
00049      "%H\thour in the 24 hour clock, 2 digits (00 - 23)\n"
00050      "%k\thour in the 24 hour clock, without leading zero (0 - 23)\n"
00051      "%I\thour in the 12 hour clock, 2 digits (01 - 12)\n"
00052      "%l\thour in the 12 hour clock, without leading zero (1 - 12)\n"
00053      "%M\tminute, 2 digits (00 - 59)\n"
00054      "%S\tseconds (00 - 59)\n"
00055      "%P\t\"am\" or \"pm\"\n"
00056      "%p\t\"AM\" or \"PM\"\n"));
00057 
00058     // It is possible that the plugin has not been loaded yet, and the
00059     // configuration dialog has been asked to be shown. In that case, it is our
00060     // turn to set the static string to the correct value.
00061     if (localizedTimeDate.isNull())
00062     {
00063         localizedTimeDate = i18nc("This is a localized string for default time & date printing on kate document."
00064                                   "%d means day in XX format."
00065                                   "%m means month in XX format."
00066                                   "%Y means year in XXXX format."
00067                                   "%H means hours in XX format."
00068                                   "%M means minutes in XX format."
00069                                   "Please, if in your language time or date is written in a different order, change it here",
00070                                   "%d-%m-%Y %H:%M");
00071     }
00072 
00073     QHBoxLayout *hlayout = new QHBoxLayout(this);
00074     QLabel *lformat = new QLabel(i18n("Format"));
00075     format = new KLineEdit(this);
00076     hlayout->addWidget(lformat);
00077     hlayout->addWidget(format);
00078 
00079     layout->addWidget(info);
00080     layout->addLayout(hlayout);
00081 
00082     setLayout(layout);
00083 
00084     load();
00085 
00086     QObject::connect(format, SIGNAL(textChanged(QString)), this, SLOT(slotChanged()));
00087 }
00088 
00089 TimeDateConfig::~TimeDateConfig()
00090 {
00091 }
00092 
00093 void TimeDateConfig::save()
00094 {
00095     if (TimeDatePlugin::self())
00096     {
00097         TimeDatePlugin::self()->setFormat(format->text());
00098         TimeDatePlugin::self()->writeConfig();
00099     }
00100     else
00101     {
00102         KConfigGroup cg(KGlobal::config(), "TimeDate Plugin");
00103         cg.writeEntry("string", format->text());
00104     }
00105 
00106     emit changed(false);
00107 }
00108 
00109 void TimeDateConfig::load()
00110 {
00111     if (TimeDatePlugin::self())
00112     {
00113         TimeDatePlugin::self()->readConfig();
00114         format->setText(TimeDatePlugin::self()->format());
00115     }
00116     else
00117     {
00118         KConfigGroup cg(KGlobal::config(), "TimeDate Plugin" );
00119         format->setText(cg.readEntry("string", localizedTimeDate));
00120     }
00121 
00122     emit changed(false);
00123 }
00124 
00125 void TimeDateConfig::defaults()
00126 {
00127     format->setText(localizedTimeDate);
00128 
00129     emit changed(true);
00130 }
00131 
00132 void TimeDateConfig::slotChanged()
00133 {
00134     emit changed(true);
00135 }
00136 
00137 #include "timedate_config.moc"

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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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