config->setGroup( "Color" );
config->writeEntry( "Popup", KitaConfig::popupColor() );
config->writeEntry( "PopupBackground", KitaConfig::popupBackgroundColor() );
+
+ config->setGroup( "Account" );
+ config->writeEntry( "UserID", KitaConfig::userID() );
+ config->writeEntry( "Password", encryptStr( KitaConfig::password() ) );
}
void KitaMainWindow::saveProperties( KConfig* config )
{
KitaConfig::setPopupBackgroundColor( popupBackgroundColor );
}
+
+ config->setGroup( "Account" );
+ KitaConfig::setUserID( config->readEntry( "UserID" ) );
+ KitaConfig::setPassword( decryptStr( config->readEntry( "Password" ) ) );
}
void KitaMainWindow::readProperties( KConfig* config )
}
+/*
+ * encryptStr and decryptStr are copied from kdepim/kmail/kmaccount.{h,cpp}
+ */
+QString KitaMainWindow::encryptStr( const QString& aStr )
+{
+ QString result;
+ for (uint i = 0; i < aStr.length(); i++)
+ result += (aStr[i].unicode() < 0x20) ? aStr[i] :
+ QChar(0x1001F - aStr[i].unicode());
+ return result;
+}
+
+QString KitaMainWindow::decryptStr( const QString& aStr )
+{
+ return encryptStr( aStr );
+}
+
#include "kita.moc"
KDockWidget* m_mainDock;
KDockWidget* m_boardDock;
KDockWidget* m_subjectDock;
+
+ QString encryptStr( const QString& str );
+ QString decryptStr( const QString& str );
void setupAccel();
void setupActions();
int m_preShowNum;
bool m_usePart;
QStringList m_partMimeList;
+ QString m_userID;
+ QString m_password;
KitaConfig();
virtual ~KitaConfig();
static void setPartMimeList( const QStringList value ) { getInstance()->m_partMimeList = value; }
static void setPartMimeList( const QString& value )
{ getInstance()->m_partMimeList = QStringList::split( ',', value ); }
+ static QString userID() { return getInstance()->m_userID; }
+ static void setUserID( const QString id ) { getInstance()->m_userID = id; }
+ static QString password() { return getInstance()->m_password; }
+ static void setPassword( const QString pass ) { getInstance()->m_password = pass; }
};
#endif
</property>
<widget class="QLabel" row="0" column="0">
<property name="name">
- <cstring>useIDLabel</cstring>
+ <cstring>userIDLabel</cstring>
</property>
<property name="text">
<string>User ID</string>
</widget>
<widget class="KLineEdit" row="0" column="1">
<property name="name">
- <cstring>useIDLine</cstring>
+ <cstring>userIDLine</cstring>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
***************************************************************************/
#include "loginprefpage.h"
+#include "kpassdlg.h"
+
using namespace Kita;
LoginPrefPage::LoginPrefPage( QWidget *parent )
: LoginPrefBase( parent )
-{}
+{
+ userIDLine->setText( KitaConfig::userID() );
+ passwordLine->insert( KitaConfig::password() );
+
+ connect( userIDLine, SIGNAL( textChanged( const QString& ) ), SIGNAL( changed() ) );
+ connect( passwordLine, SIGNAL( textChanged( const QString& ) ), SIGNAL( changed() ) );
+}
LoginPrefPage::~LoginPrefPage()
{}
+void LoginPrefPage::apply()
+{
+ KitaConfig::setUserID( userIDLine->text() );
+ KitaConfig::setPassword( passwordLine->password() );
+}
+
#include "loginprefpage.moc"
class LoginPrefPage : public LoginPrefBase
{
Q_OBJECT
+ public slots:
+ void apply();
public:
LoginPrefPage( QWidget *parent = 0 );
~LoginPrefPage();
+ signals:
+ void changed();
};
}
connect( m_asciiArtPage, SIGNAL( changed() ), SLOT( slotChanged() ) );
connect( m_uiPage, SIGNAL( changed() ), SLOT( slotChanged() ) );
connect( m_abonePage, SIGNAL( changed() ), SLOT( slotChanged() ) );
+ connect( m_loginPage, SIGNAL( changed() ), SLOT( slotChanged() ) );
}
void KitaPreferences::slotApply()
m_abonePage->apply();
break;
case 5:
+ // login
+ m_loginPage->apply();
+ break;
+ case 6:
// debug
break;
}
m_asciiArtPage->commit();
m_uiPage->apply();
m_abonePage->apply();
+ m_loginPage->apply();
KDialogBase::slotOk();
}