svnno****@sourc*****
svnno****@sourc*****
2009年 7月 23日 (木) 06:44:40 JST
Revision: 2464 http://sourceforge.jp/projects/kita/svn/view?view=rev&revision=2464 Author: nogu Date: 2009-07-23 06:44:40 +0900 (Thu, 23 Jul 2009) Log Message: ----------- implement WriteConfig Modified Paths: -------------- kita/branches/KITA-KDE4/kita/src/libkita/CMakeLists.txt kita/branches/KITA-KDE4/kita/src/libkita/config_xt.kcfg kita/branches/KITA-KDE4/kita/src/prefs/writeprefbase.ui kita/branches/KITA-KDE4/kita/src/prefs/writeprefpage.cpp kita/branches/KITA-KDE4/kita/src/prefs/writeprefpage.h kita/branches/KITA-KDE4/kita/src/writeview.cpp Added Paths: ----------- kita/branches/KITA-KDE4/kita/src/libkita/write.kcfg kita/branches/KITA-KDE4/kita/src/libkita/write.kcfgc Modified: kita/branches/KITA-KDE4/kita/src/libkita/CMakeLists.txt =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/CMakeLists.txt 2009-07-22 13:45:50 UTC (rev 2463) +++ kita/branches/KITA-KDE4/kita/src/libkita/CMakeLists.txt 2009-07-22 21:44:40 UTC (rev 2464) @@ -26,7 +26,11 @@ threadinfo.h threadindex.cpp) -kde4_add_kcfg_files(kita_LIB_SRCS abone.kcfgc asciiart.kcfgc config_xt.kcfgc) +kde4_add_kcfg_files(kita_LIB_SRCS + abone.kcfgc + asciiart.kcfgc + config_xt.kcfgc + write.kcfgc) kde4_add_library(kitautil SHARED ${kita_LIB_SRCS}) Modified: kita/branches/KITA-KDE4/kita/src/libkita/config_xt.kcfg =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/config_xt.kcfg 2009-07-22 13:45:50 UTC (rev 2463) +++ kita/branches/KITA-KDE4/kita/src/libkita/config_xt.kcfg 2009-07-22 21:44:40 UTC (rev 2464) @@ -109,21 +109,6 @@ <label>Maru password</label> </entry> </group> - <group name="Write"> - <entry name="DefaultName" type="String"> - <label>Default name.</label> - </entry> - <entry name="DefaultNameUseAlways" type="Bool"> - <label>Whether use default name or not.</label> - <default>false</default> - </entry> - <entry name="DefaultMail" type="String"> - <label>Default mail address.</label> - </entry> - <entry name="DefaultSage" type="Bool"> - <label>Whether use 'sage' as default or not.</label> - </entry> - </group> <group name="Completion"> <entry name="NameCompletionList" type="StringList"> <label>Name Completion list.</label> Added: kita/branches/KITA-KDE4/kita/src/libkita/write.kcfg =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/write.kcfg (rev 0) +++ kita/branches/KITA-KDE4/kita/src/libkita/write.kcfg 2009-07-22 21:44:40 UTC (rev 2464) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + <kcfgfile name="kitarc" /> + <group name="Write"> + <entry name="DefaultName" type="String"> + <label>Default name.</label> + </entry> + <entry name="DefaultNameUseAlways" type="Bool"> + <label>Whether use default name or not.</label> + <default>false</default> + </entry> + <entry name="DefaultMail" type="String"> + <label>Default mail address.</label> + </entry> + <entry name="DefaultSage" type="Bool"> + <label>Whether use 'sage' as default or not.</label> + <default>true</default> + </entry> + </group> +</kcfg> Added: kita/branches/KITA-KDE4/kita/src/libkita/write.kcfgc =================================================================== --- kita/branches/KITA-KDE4/kita/src/libkita/write.kcfgc (rev 0) +++ kita/branches/KITA-KDE4/kita/src/libkita/write.kcfgc 2009-07-22 21:44:40 UTC (rev 2464) @@ -0,0 +1,6 @@ +File=write.kcfg +ClassName=WriteConfig +NameSpace=Kita +Singleton=true +Mutators=true +Visibility=KDE_EXPORT Modified: kita/branches/KITA-KDE4/kita/src/prefs/writeprefbase.ui =================================================================== --- kita/branches/KITA-KDE4/kita/src/prefs/writeprefbase.ui 2009-07-22 13:45:50 UTC (rev 2463) +++ kita/branches/KITA-KDE4/kita/src/prefs/writeprefbase.ui 2009-07-22 21:44:40 UTC (rev 2464) @@ -115,12 +115,4 @@ <includes> <include location="local" >klineedit.h</include> </includes> - <connections> - <connection> - <sender>kcfg_DefaultSage</sender> - <signal>toggled(bool)</signal> - <receiver>Kita::WritePrefBase</receiver> - <slot>DefaultSageCheckBoxToggled(bool)</slot> - </connection> - </connections> </ui> Modified: kita/branches/KITA-KDE4/kita/src/prefs/writeprefpage.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/prefs/writeprefpage.cpp 2009-07-22 13:45:50 UTC (rev 2463) +++ kita/branches/KITA-KDE4/kita/src/prefs/writeprefpage.cpp 2009-07-22 21:44:40 UTC (rev 2464) @@ -10,22 +10,44 @@ #include "writeprefpage.h" +#include "libkita/write.h" + using namespace Kita; WritePrefPage::WritePrefPage(QWidget* parent) : AbstractPrefPage(parent) { setupUi(this); load(); + connect(kcfg_DefaultSage, SIGNAL(toggled(bool)), SLOT(slotToggled(bool))); } void WritePrefPage::apply() { + WriteConfig::setDefaultName(kcfg_DefaultName->text()); + WriteConfig::setDefaultNameUseAlways( + kcfg_DefaultNameUseAlways->isChecked()); + WriteConfig::setDefaultMail(kcfg_DefaultMail->text()); + WriteConfig::setDefaultSage(kcfg_DefaultSage->isChecked()); } void WritePrefPage::load() { + kcfg_DefaultName->setText(WriteConfig::defaultName()); + kcfg_DefaultNameUseAlways->setChecked(WriteConfig::defaultNameUseAlways()); + kcfg_DefaultMail->setText(WriteConfig::defaultMail()); + bool isSage = WriteConfig::defaultSage(); + kcfg_DefaultMail->setReadOnly(isSage); + kcfg_DefaultSage->setChecked(isSage); } void WritePrefPage::reset() { + WriteConfig::self()->useDefaults(true); + load(); + WriteConfig::self()->useDefaults(false); } + +void WritePrefPage::slotToggled(bool on) +{ + kcfg_DefaultMail->setReadOnly(on); +} Modified: kita/branches/KITA-KDE4/kita/src/prefs/writeprefpage.h =================================================================== --- kita/branches/KITA-KDE4/kita/src/prefs/writeprefpage.h 2009-07-22 13:45:50 UTC (rev 2463) +++ kita/branches/KITA-KDE4/kita/src/prefs/writeprefpage.h 2009-07-22 21:44:40 UTC (rev 2464) @@ -24,6 +24,8 @@ virtual void apply(); virtual void load(); virtual void reset(); + private slots: + void slotToggled(bool on); }; } Modified: kita/branches/KITA-KDE4/kita/src/writeview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/writeview.cpp 2009-07-22 13:45:50 UTC (rev 2463) +++ kita/branches/KITA-KDE4/kita/src/writeview.cpp 2009-07-22 21:44:40 UTC (rev 2464) @@ -30,6 +30,7 @@ #include "libkita/kita-utf8.h" #include "libkita/k2ch.h" #include "libkita/machibbs.h" +#include "libkita/write.h" using namespace Kita; @@ -79,16 +80,16 @@ boardNameLabel->setText(BoardManager::boardName(m_datURL)); // setup name field. - nameLine->setText(Config::defaultName()); + nameLine->setText(WriteConfig::defaultName()); QStringList compList = Config::self()->nameCompletionList(); nameLine->completionObject()->setItems(compList); // setup mail field & 'sage' checkbox - if (Config::defaultSage()) { + if (WriteConfig::defaultSage()) { mailLine->setText("sage"); sageBox->setChecked(true); } else { - mailLine->setText(Config::defaultMail()); + mailLine->setText(WriteConfig::defaultMail()); } m_mailswap = "";