summaryrefslogtreecommitdiff
authorzecke <zecke>2002-11-03 11:11:28 (UTC)
committer zecke <zecke>2002-11-03 11:11:28 (UTC)
commite84a1bc31c336df5aea13ac23a47bc15b6ca2e8d (patch) (side-by-side diff)
tree65c0a66d7fce49f012549fcfb97724c074a38511
parentd26f82ea57c70fd0e77eb192f7e133c5f76c2f0f (diff)
downloadopie-e84a1bc31c336df5aea13ac23a47bc15b6ca2e8d.zip
opie-e84a1bc31c336df5aea13ac23a47bc15b6ca2e8d.tar.gz
opie-e84a1bc31c336df5aea13ac23a47bc15b6ca2e8d.tar.bz2
patch by jowenn no default arguments....
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/comm/keypebble/kvncbookmarkdlg.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/comm/keypebble/kvncbookmarkdlg.cpp b/noncore/comm/keypebble/kvncbookmarkdlg.cpp
index 1e2f3c3..8556d49 100644
--- a/noncore/comm/keypebble/kvncbookmarkdlg.cpp
+++ b/noncore/comm/keypebble/kvncbookmarkdlg.cpp
@@ -1,149 +1,149 @@
#include <qframe.h>
#include <qvbox.h>
#include <qcheckbox.h>
#include <qspinbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qwhatsthis.h>
#include <qfile.h>
#include <qdir.h>
#include <qstring.h>
#include <qapplication.h>
#include <qlineedit.h>
#include <qtextstream.h>
#include <qpushbutton.h>
#include <qlistbox.h>
#include <qpe/config.h>
#include <qpe/global.h>
#include "krfbserver.h"
#include "kvncbookmarkdlg.h"
-KVNCBookmarkDlg::KVNCBookmarkDlg( QWidget * parent=0, const char * name=0, WFlags f=0 )
+KVNCBookmarkDlg::KVNCBookmarkDlg( QWidget * parent, const char * name, WFlags f )
: KVNCBookmarkDlgBase( parent, name,f)
{
readBookmarks();
refresh();
}
KVNCBookmarkDlg::~KVNCBookmarkDlg()
{
}
void KVNCBookmarkDlg::addBookmark(KRFBServer * server)
{
if (server) {
servers.append(server);
bookmarkList->insertItem(server->name);
writeBookmarks();
refresh();
}
}
void KVNCBookmarkDlg::deleteBookmark(QString name)
{
KRFBServer * server=0;
for ( server=servers.first(); server != 0; server=servers.next() ) {
if (server->name==name) {
servers.remove(servers.at());
writeBookmarks();
refresh();
return;
}
}
}
KRFBServer *KVNCBookmarkDlg::getServer(QString name)
{
KRFBServer * server=0;
for ( server=servers.first(); server != 0; server=servers.next() ) {
if (server->name==name)
return server;
}
return 0;
}
/*
Note that the degree of protection offered by the encryption here is
only sufficient to avoid the most casual observation of the configuration
files. People with access to the files can write down the contents and
decrypt it using this source code.
Conceivably, and at some burden to the user, this encryption could
be improved.
*/
QString KVNCBookmarkDlg::encipher(const QString& plain)
{
// mainly, we make it long
QString cipher;
int mix=28730492;
for (int i=0; i<(int)plain.length(); i++) {
int u = plain[i].unicode();
int c = u ^ mix;
QString x = QString::number(c,36);
cipher.append(QChar('a'+x.length()));
cipher.append(x);
mix *= u;
}
return cipher;
}
QString KVNCBookmarkDlg::decipher(const QString& cipher)
{
QString plain;
int mix=28730492;
for (int i=0; i<(int)cipher.length();) {
int l = cipher[i].unicode()-'a';
QString x = cipher.mid(i+1,l); i+=l+1;
int u = x.toInt(0,36) ^ mix;
plain.append(QChar(u));
mix *= u;
}
return plain;
}
void KVNCBookmarkDlg::readBookmarks(void)
{
QFile f(QDir::homeDirPath() + QString("/Applications/keypebble/bookmarks"));
QStringList entry;
QString key, val;
KRFBServer * server=0;
if ( f.open(IO_ReadOnly) ) {
QTextStream t( &f );
QString s;
int n = 1;
while ( !t.eof() ) {
s = t.readLine();
entry=QStringList::split('=',s);
key=entry[0].stripWhiteSpace().lower();
val=entry[1].stripWhiteSpace();
if (key=="server") {
if (server){
servers.append(server);
server=0;
}
server = new KRFBServer();
if (!server)
return;
server->name=val;
}
else if (key=="hostname")
server->hostname=val;
else if (key=="password")
server->password=decipher(val);
else if (key=="display")
server->display=val.toInt();
else if (key=="hextile")
server->hexTile=val.toInt();
else if (key=="corre")
server->corre=val.toInt();