From 438e27ae1e2f4a3817298d659a4eea3f76dbbd04 Mon Sep 17 00:00:00 2001 From: tarek_saidi Date: Mon, 5 Jun 2006 22:27:06 +0000 Subject: [PATCH] removed all old Qt3 depedencies, Qt3Support is not longer needed git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@92 b624d157-de02-0410-bad0-e51aec6abb33 --- src/PwManager.cpp | 84 ++++++++++++++--------------- src/PwmConfig.cpp | 38 ++++++------- src/dialogs/AboutDlg.cpp | 12 ++--- src/dialogs/AboutDlg.h | 2 +- src/dialogs/DatabaseSettingsDlg.cpp | 12 ++--- src/dialogs/DatabaseSettingsDlg.h | 2 +- src/dialogs/EditEntryDlg.cpp | 71 +++++++++++++----------- src/dialogs/EditEntryDlg.h | 2 +- src/dialogs/EditGroupDlg.cpp | 14 ++--- src/dialogs/EditGroupDlg.h | 2 +- src/dialogs/PasswordDlg.cpp | 12 ++--- src/dialogs/PasswordDlg.h | 2 +- src/dialogs/PasswordGenDlg.cpp | 9 ++-- src/dialogs/PasswordGenDlg.h | 2 +- src/dialogs/SearchDlg.cpp | 8 +-- src/dialogs/SearchDlg.h | 2 +- src/dialogs/SelectIconDlg.cpp | 4 +- src/dialogs/SelectIconDlg.h | 4 +- src/dialogs/SimplePasswordDlg.cpp | 4 +- src/dialogs/SimplePasswordDlg.h | 2 +- src/export/Export_Txt.cpp | 4 +- src/forms/DatabaseSettingsDlg.ui | 2 +- src/forms/EditEntryDlg.ui | 11 +--- src/forms/PasswordDlg.ui | 14 +---- src/forms/PasswordGenDlg.ui | 4 +- src/forms/SearchDlg.ui | 14 +---- src/forms/SettingsDlg.ui | 11 +--- src/import/Import_KWalletXml.cpp | 6 +-- src/import/Import_PwManager.cpp | 8 +-- src/lib/AutoType_X11.cpp | 2 +- src/lib/EntryView.cpp | 2 +- src/lib/GroupView.cpp | 2 +- src/lib/UrlLabel.cpp | 15 +++--- src/lib/UrlLabel.h | 5 +- src/main.cpp | 14 ++--- src/mainwindow.cpp | 46 ++++++++-------- src/src.pro | 2 +- 37 files changed, 211 insertions(+), 239 deletions(-) diff --git a/src/PwManager.cpp b/src/PwManager.cpp index 37508b2..3f70471 100755 --- a/src/PwManager.cpp +++ b/src/PwManager.cpp @@ -87,7 +87,7 @@ if(!file->open(QIODevice::ReadWrite)){ } total_size=file->size(); char* buffer = new char[total_size]; -file->readBlock(buffer,total_size); +file->read(buffer,total_size); if(total_size < DB_HEADER_SIZE){ err=tr("Unexpected file size (DB_TOTAL_SIZE < DB_HEADER_SIZE)"); @@ -418,7 +418,7 @@ if(Password == QString::null) return false; paKey = new char[Password.length() + 1]; if(paKey == NULL) return false; -strcpy(paKey, Password); +strcpy(paKey, Password.toUtf8()); @@ -447,13 +447,13 @@ if(file.open(QIODevice::ReadOnly) == false) return false; unsigned long FileSize=file.size(); if(FileSize == 32){ - if(file.readBlock((char*)MasterKey,32) != 32){ + if(file.read((char*)MasterKey,32) != 32){ file.close(); return false;} } else if(FileSize == 64){ char hex[64]; - if(file.readBlock(hex,64) != 64){ + if(file.read(hex,64) != 64){ file.close(); return false;} file.close(); @@ -467,7 +467,7 @@ sha256_starts(&sha32); unsigned char* buffer = new unsigned char[2048]; while(1) { - unsigned long read=file.readBlock((char*)buffer,2048); + unsigned long read=file.read((char*)buffer,2048); if(read == 0) break; sha256_update(&sha32,buffer,read); if(read != 2048) break; @@ -535,13 +535,13 @@ QFile file(filename); if(file.open(QIODevice::ReadOnly) == false) return false; unsigned long FileSize=file.size(); if(FileSize == 32){ - if(file.readBlock((char*)FileKey,32) != 32){ + if(file.read((char*)FileKey,32) != 32){ file.close(); return false;} } else if(FileSize == 64){ char hex[64]; - if(file.readBlock(hex,64) != 64){ + if(file.read(hex,64) != 64){ file.close(); return false;} file.close(); @@ -552,7 +552,7 @@ sha256_starts(&sha32); unsigned char* buffer = new unsigned char[2048]; while(1) { - unsigned long read=file.readBlock((char*)buffer,2048); + unsigned long read=file.read((char*)buffer,2048); if(read == 0) break; sha256_update(&sha32,buffer,read); if(read != 2048) break; @@ -569,7 +569,7 @@ char *paKey = NULL; if(Password == QString::null) return false; paKey = new char[Password.length() + 1]; if(paKey == NULL) return false; -strcpy(paKey, Password); +strcpy(paKey, Password.toUtf8()); if(paKey == NULL) return false; KeyLen = strlen(paKey); if(KeyLen == 0) { @@ -796,23 +796,23 @@ MetaStreams << &CustomIconsMetaStream; FileSize=DB_HEADER_SIZE; // Get the size of all groups (94 Byte + length of the name string) for(int i = 0; i < Groups.size(); i++){ - FileSize += 94 + Groups[i].Name.utf8().length()+1; + FileSize += 94 + Groups[i].Name.toUtf8().length()+1; } // Get the size of all entries for(int i = 0; i < Entries.size(); i++){ FileSize += 134 - +Entries[i].Title.utf8().length()+1 - +Entries[i].UserName.utf8().length()+1 - +Entries[i].URL.utf8().length()+1 + +Entries[i].Title.toUtf8().length()+1 + +Entries[i].UserName.toUtf8().length()+1 + +Entries[i].URL.toUtf8().length()+1 +Entries[i].Password.length()+1 - +Entries[i].Additional.utf8().length()+1 - +Entries[i].BinaryDesc.utf8().length()+1 + +Entries[i].Additional.toUtf8().length()+1 + +Entries[i].BinaryDesc.toUtf8().length()+1 +Entries[i].BinaryData.length(); } for(int i=0; i < MetaStreams.size(); i++){ FileSize +=164 - +MetaStreams[i]->Additional.utf8().length()+1 + +MetaStreams[i]->Additional.toUtf8().length()+1 +MetaStreams[i]->BinaryData.length(); } @@ -845,10 +845,10 @@ for(int i=0; i < Groups.size(); i++){ memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; memcpyToLEnd32(buffer+pos, &Groups[i].ID); pos += 4; - FieldType = 0x0002; FieldSize = Groups[i].Name.utf8().length() + 1; + FieldType = 0x0002; FieldSize = Groups[i].Name.toUtf8().length() + 1; memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; - memcpy(buffer+pos, Groups[i].Name.utf8(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, Groups[i].Name.toUtf8(),FieldSize); pos += FieldSize; FieldType = 0x0003; FieldSize = 5; memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; @@ -908,36 +908,36 @@ for(int i = 0; i < Entries.size(); i++){ FieldType = 0x0004; - FieldSize = Entries[i].Title.utf8().length() + 1; // Add terminating NULL character space + FieldSize = Entries[i].Title.toUtf8().length() + 1; // Add terminating NULL character space memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; - memcpy(buffer+pos, Entries[i].Title.utf8(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, Entries[i].Title.toUtf8(),FieldSize); pos += FieldSize; FieldType = 0x0005; - FieldSize = Entries[i].URL.utf8().length() + 1; // Add terminating NULL character space + FieldSize = Entries[i].URL.toUtf8().length() + 1; // Add terminating NULL character space memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; - memcpy(buffer+pos, Entries[i].URL.utf8(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, Entries[i].URL.toUtf8(),FieldSize); pos += FieldSize; FieldType = 0x0006; - FieldSize = Entries[i].UserName.utf8().length() + 1; // Add terminating NULL character space + FieldSize = Entries[i].UserName.toUtf8().length() + 1; // Add terminating NULL character space memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; - memcpy(buffer+pos, Entries[i].UserName.utf8(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, Entries[i].UserName.toUtf8(),FieldSize); pos += FieldSize; FieldType = 0x0007; FieldSize = Entries[i].Password.length() + 1; // Add terminating NULL character space memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; Entries[i].Password.unlock(); - memcpy(buffer+pos, Entries[i].Password.string(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, Entries[i].Password.string().toUtf8(),FieldSize); pos += FieldSize; Entries[i].Password.lock(); FieldType = 0x0008; - FieldSize = Entries[i].Additional.utf8().length() + 1; // Add terminating NULL character space + FieldSize = Entries[i].Additional.toUtf8().length() + 1; // Add terminating NULL character space memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; - memcpy(buffer+pos, Entries[i].Additional.utf8(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, Entries[i].Additional.toUtf8(),FieldSize); pos += FieldSize; FieldType = 0x0009; FieldSize = 5; memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; @@ -961,10 +961,10 @@ for(int i = 0; i < Entries.size(); i++){ dateToPackedStruct5(Entries[i].Expire,(unsigned char*)buffer+pos); pos+=5; FieldType = 0x000D; - FieldSize = Entries[i].BinaryDesc.utf8().length() + 1; // Add terminating NULL character space + FieldSize = Entries[i].BinaryDesc.toUtf8().length() + 1; // Add terminating NULL character space memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; - memcpy(buffer+pos, Entries[i].BinaryDesc.utf8(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, Entries[i].BinaryDesc.toUtf8(),FieldSize); pos += FieldSize; FieldType = 0x000E; FieldSize = Entries[i].BinaryData.length(); memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; @@ -996,36 +996,36 @@ for(int i = 0; i < MetaStreams.size(); i++){ FieldType = 0x0004; - FieldSize = MetaStreams[i]->Title.utf8().length() + 1; // Add terminating NULL character space + FieldSize = MetaStreams[i]->Title.toUtf8().length() + 1; // Add terminating NULL character space memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; - memcpy(buffer+pos, MetaStreams[i]->Title.utf8(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, MetaStreams[i]->Title.toUtf8(),FieldSize); pos += FieldSize; FieldType = 0x0005; - FieldSize = MetaStreams[i]->URL.utf8().length() + 1; // Add terminating NULL character space + FieldSize = MetaStreams[i]->URL.toUtf8().length() + 1; // Add terminating NULL character space memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; - memcpy(buffer+pos, MetaStreams[i]->URL.utf8(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, MetaStreams[i]->URL.toUtf8(),FieldSize); pos += FieldSize; FieldType = 0x0006; - FieldSize = MetaStreams[i]->UserName.utf8().length() + 1; // Add terminating NULL character space + FieldSize = MetaStreams[i]->UserName.toUtf8().length() + 1; // Add terminating NULL character space memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; - memcpy(buffer+pos, MetaStreams[i]->UserName.utf8(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, MetaStreams[i]->UserName.toUtf8(),FieldSize); pos += FieldSize; FieldType = 0x0007; FieldSize = MetaStreams[i]->Password.length() + 1; // Add terminating NULL character space memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; MetaStreams[i]->Password.unlock(); - memcpy(buffer+pos, MetaStreams[i]->Password.string(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, MetaStreams[i]->Password.string().toUtf8(),FieldSize); pos += FieldSize; MetaStreams[i]->Password.lock(); FieldType = 0x0008; - FieldSize = MetaStreams[i]->Additional.utf8().length() + 1; // Add terminating NULL character space + FieldSize = MetaStreams[i]->Additional.toUtf8().length() + 1; // Add terminating NULL character space memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; - memcpy(buffer+pos, MetaStreams[i]->Additional.utf8(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, MetaStreams[i]->Additional.toUtf8(),FieldSize); pos += FieldSize; FieldType = 0x0009; FieldSize = 5; memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; @@ -1049,10 +1049,10 @@ for(int i = 0; i < MetaStreams.size(); i++){ dateToPackedStruct5(MetaStreams[i]->Expire,(unsigned char*)buffer+pos); pos+=5; FieldType = 0x000D; - FieldSize = MetaStreams[i]->BinaryDesc.utf8().length() + 1; // Add terminating NULL character space + FieldSize = MetaStreams[i]->BinaryDesc.toUtf8().length() + 1; // Add terminating NULL character space memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4; - memcpy(buffer+pos, MetaStreams[i]->BinaryDesc.utf8(),FieldSize); pos += FieldSize; + memcpy(buffer+pos, MetaStreams[i]->BinaryDesc.toUtf8(),FieldSize); pos += FieldSize; FieldType = 0x000E; FieldSize = MetaStreams[i]->BinaryData.length(); memcpyToLEnd16(buffer+pos, &FieldType); pos += 2; @@ -1117,7 +1117,7 @@ return false; } file->resize(0); //truncate -if(file->writeBlock(buffer,EncryptedPartSize+DB_HEADER_SIZE)!=EncryptedPartSize+DB_HEADER_SIZE){ +if(file->write(buffer,EncryptedPartSize+DB_HEADER_SIZE)!=EncryptedPartSize+DB_HEADER_SIZE){ delete [] buffer; return false; } @@ -1648,7 +1648,7 @@ bool testDatabase(){ bool loadedDB = cloneDatabase.openDatabase(dbPath, err); if (!loadedDB){ kp_assert(results, loadedDB); - cout << err.ascii() << endl; + qWarning((err+QString('\n')).toAscii()); } assertDatabasesEq(results, &database, &cloneDatabase); diff --git a/src/PwmConfig.cpp b/src/PwmConfig.cpp index b74ef7e..31acb45 100755 --- a/src/PwmConfig.cpp +++ b/src/PwmConfig.cpp @@ -38,7 +38,7 @@ using namespace std; bool CConfig::loadFromIni(QString filename){ QString defaultSearchOptions = "001101111"; QString defaultPwGenOptions = "1111100001"; -ini.SetPath((const char*)filename); +ini.SetPath((const char*)filename.toUtf8()); ini.ReadFile(); ClipboardTimeOut=ini.GetValueI("Options","ClipboardTimeOut",20); Toolbar=ini.GetValueB("UI","ShowToolbar",true); @@ -52,10 +52,10 @@ BannerTextColor=ParseColorString(ini.GetValue("Options","BannerTextColor","222,2 ShowPasswords=ini.GetValueB("Options","ShowPasswords",false); OpenUrlCommand=ini.GetValue("Options","UrlCmd","kfmclient openURL %1").c_str(); Language=ini.GetValue("Options","LangFile","").c_str(); -ParseBoolString(ini.GetValue("Options","SearchOptions",defaultSearchOptions.ascii()).c_str(),defaultSearchOptions,SearchOptions,9); +ParseBoolString(ini.GetValue("Options","SearchOptions",(const char*)defaultSearchOptions.toUtf8()).c_str(),defaultSearchOptions,SearchOptions,9); ListView_HidePasswords=ini.GetValueB("UI","HidePasswords",true); ListView_HideUsernames=ini.GetValueB("UI","HideUsernames",false); -ParseBoolString(ini.GetValue("Options","PwGenOptions",defaultPwGenOptions.ascii()).c_str(),defaultPwGenOptions,PwGenOptions,10); +ParseBoolString(ini.GetValue("Options","PwGenOptions",(const char*)defaultPwGenOptions.toUtf8()).c_str(),defaultPwGenOptions,PwGenOptions,10); PwGenLength=ini.GetValueI("Options","PwGenLength",25); PwGenCharList=ini.GetValue("Options","PwGenCharList","").c_str(); ExpandGroupTree=ini.GetValueB("Options","ExpandGroupTree",true); @@ -81,34 +81,34 @@ ini.SetValueI("Options","ClipboardTimeOut",ClipboardTimeOut); ini.SetValueB("UI","ShowToolbar",Toolbar); ini.SetValueB("UI","ShowEntryDetails",EntryDetails); ini.SetValueB("Options","RememberLastFile",OpenLast); - if(OpenLast)ini.SetValue("Options","LastFile",(const char*)LastFile); + if(OpenLast)ini.SetValue("Options","LastFile",(const char*)LastFile.toUtf8()); else ini.SetValue("Options","LastFile",""); -ini.SetValue("UI","Columns",(const char*)CreateColumnString(),true); -ini.SetValue("Options","BannerColor1",(const char*)CreateColorString(BannerColor1),true); -ini.SetValue("Options","BannerColor2",(const char*)CreateColorString(BannerColor2),true); -ini.SetValue("Options","BannerTextColor",(const char*)CreateColorString(BannerTextColor),true); +ini.SetValue("UI","Columns",(const char*)CreateColumnString().toUtf8(),true); +ini.SetValue("Options","BannerColor1",(const char*)CreateColorString(BannerColor1).toUtf8(),true); +ini.SetValue("Options","BannerColor2",(const char*)CreateColorString(BannerColor2).toUtf8(),true); +ini.SetValue("Options","BannerTextColor",(const char*)CreateColorString(BannerTextColor).toUtf8(),true); ini.SetValueB("Options","ShowPasswords",ShowPasswords,true); -ini.SetValue("Options","UrlCmd",(const char*)OpenUrlCommand,true); -ini.SetValue("Options","LangFile",(const char*)Language,true); -ini.SetValue("Options","SearchOptions",(const char*)CreateBoolString(SearchOptions,9),true); +ini.SetValue("Options","UrlCmd",(const char*)OpenUrlCommand.toUtf8(),true); +ini.SetValue("Options","LangFile",(const char*)Language.toUtf8(),true); +ini.SetValue("Options","SearchOptions",(const char*)CreateBoolString(SearchOptions,9).toUtf8(),true); ini.SetValueB("UI","HidePasswords",ListView_HidePasswords); ini.SetValueB("UI","HideUsernames",ListView_HideUsernames); -ini.SetValue("Options","PwGenOptions",(const char*)CreateBoolString(PwGenOptions,10),true); +ini.SetValue("Options","PwGenOptions",(const char*)CreateBoolString(PwGenOptions,10).toUtf8(),true); ini.SetValueI("Options","PwGenLength",PwGenLength,true); -ini.SetValue("Options","PwGenCharList",(const char*)PwGenCharList,true); +ini.SetValue("Options","PwGenCharList",(const char*)PwGenCharList.toUtf8(),true); ini.SetValueB("Options","ExpandGroupTree",ExpandGroupTree,true); ini.SetValueB("KDE Plugin","Enabled",EnableKdePlugin,true); ini.SetValueI("UI","MainWinHeight",MainWinHeight); ini.SetValueI("UI","MainWinWidth",MainWinWidth); ini.SetValueI("UI","MainWinSplit1",MainWinSplit1); ini.SetValueI("UI","MainWinSplit2",MainWinSplit2); -ini.SetValue("UI","ColumnSizes",(const char*)CreateIntString(ColumnSizes,10),true); +ini.SetValue("UI","ColumnSizes",(const char*)CreateIntString(ColumnSizes,10).toUtf8(),true); ini.SetValueB("UI","ShowStatusbar",ShowStatusbar); ini.SetValueB("Options","AlternatingRowColors",AlternatingRowColors); -ini.SetValue("Options","MountDir",(const char*)MountDir); +ini.SetValue("Options","MountDir",(const char*)MountDir.toUtf8()); ini.SetValueB("Options","RememberLastKey",RememberLastKey); if(RememberLastKey){ - ini.SetValue("Options","LastKeyLocation",(const char*)LastKeyLocation); + ini.SetValue("Options","LastKeyLocation",(const char*)LastKeyLocation.toUtf8()); ini.SetValueI("Options","LastKeyType",LastKeyType);} else{ ini.SetValue("Options","LastKeyLocation",""); @@ -142,16 +142,16 @@ return str; } QColor CConfig::ParseColorString(QString str){ -QStringList lst=QStringList::split(',',str); +QStringList lst=str.split(','); if(lst.size()!=3){ - qWarning(QObject::tr("Warning:")+" CConfig::ParseColorString(QString):"+QObject::tr("Invalid RGB color value.\n")); + qWarning((QObject::tr("Warning:")+" CConfig::ParseColorString(QString):"+QObject::tr("Invalid RGB color value.\n")).toUtf8()); return QColor(0,0,0);} bool err[3]; int r=lst[0].toUInt(err); int g=lst[1].toUInt(err+1); int b=lst[2].toUInt(err+2); if(!err[0] || !err[1] || !err[2]){ - qWarning(QObject::tr("Warning:")+" CConfig::ParseColorString(QString):"+QObject::tr("Invalid RGB color value.\n")); + qWarning((QObject::tr("Warning:")+" CConfig::ParseColorString(QString):"+QObject::tr("Invalid RGB color value.\n")).toUtf8()); return QColor(0,0,0);} return QColor(r,g,b); } diff --git a/src/dialogs/AboutDlg.cpp b/src/dialogs/AboutDlg.cpp index 2e3a8d6..666d551 100755 --- a/src/dialogs/AboutDlg.cpp +++ b/src/dialogs/AboutDlg.cpp @@ -26,8 +26,8 @@ #include "main.h" #include "AboutDlg.h" -CAboutDialog::CAboutDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) -: QDialog(parent,name, modal,fl) +CAboutDialog::CAboutDialog(QWidget* parent,bool modal, Qt::WFlags fl) +: QDialog(parent,fl) { setupUi(this); createBanner(Banner,Icon_Key32x32,tr("KeePassX %1").arg(KEEPASS_VERSION)); @@ -42,7 +42,7 @@ if(TrActive){ } AboutTr+="
"; } -Edit_Translation->setText(AboutTr+tr("\ +Edit_Translation->setHtml(AboutTr+tr("\ Information on how to translate KeePassX can be found under:\n\ http://keepass.berlios.de/")); QString str; @@ -55,7 +55,7 @@ str+="
"; str+=""+tr("Thanks To")+""; str+="
"; str+=""+tr("Matthias Miller")+"
"+tr("Patches for better MacOS X support")+"
"+tr("www.outofhanwell.com")+"
"; -Edit_Thanks->setText(str); +Edit_Thanks->setHtml(str); } CAboutDialog::~CAboutDialog() @@ -86,9 +86,9 @@ return; } char* buffer=new char[gpl.size()]; -long l=gpl.readBlock(buffer,gpl.size()); +long l=gpl.read(buffer,gpl.size()); gpl.close(); -Edit_License->setText(QString::fromUtf8(buffer,l)); +Edit_License->setHtml(QString::fromUtf8(buffer,l)); delete buffer; } diff --git a/src/dialogs/AboutDlg.h b/src/dialogs/AboutDlg.h index c061223..eecf4ec 100755 --- a/src/dialogs/AboutDlg.h +++ b/src/dialogs/AboutDlg.h @@ -29,7 +29,7 @@ class CAboutDialog : public QDialog, public Ui_AboutDlg { Q_OBJECT public: - CAboutDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); + CAboutDialog(QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); ~CAboutDialog(); public slots: diff --git a/src/dialogs/DatabaseSettingsDlg.cpp b/src/dialogs/DatabaseSettingsDlg.cpp index 5510736..a3ddd04 100755 --- a/src/dialogs/DatabaseSettingsDlg.cpp +++ b/src/dialogs/DatabaseSettingsDlg.cpp @@ -26,8 +26,8 @@ #include "DatabaseSettingsDlg.h" -CDbSettingsDlg::CDbSettingsDlg(QWidget* parent,Database* db, const char* name, bool modal, Qt::WFlags fl) -: QDialog(parent,name, modal,fl) +CDbSettingsDlg::CDbSettingsDlg(QWidget* parent,Database* db, bool modal, Qt::WFlags fl) +: QDialog(parent,fl) { setupUi(this); database=db; @@ -42,9 +42,9 @@ CDbSettingsDlg::~CDbSettingsDlg() void CDbSettingsDlg::showEvent(QShowEvent *event){ if(event->spontaneous()==false){ createBanner(Banner,Icon_Settings32x32,tr("Settings")); -ComboAlgo->insertItem(tr("AES(Rijndael): 256 Bit (default)"),0); -ComboAlgo->insertItem(tr("Twofish: 256 Bit"),1); -ComboAlgo->setCurrentItem(database->CryptoAlgorithmus); //Achtung: AlgoID muss gleich dem ComboBox Index sein! +ComboAlgo->insertItem(0,tr("AES(Rijndael): 256 Bit (default)")); +ComboAlgo->insertItem(1,tr("Twofish: 256 Bit")); +ComboAlgo->setCurrentIndex(database->CryptoAlgorithmus); //Achtung: AlgoID muss gleich dem ComboBox Index sein! EditRounds->setText(QString::number(database->KeyEncRounds)); } @@ -73,7 +73,7 @@ QMessageBox::warning(NULL,tr("Error"),tr("The number of encryption rounds have t return; } database->KeyEncRounds=rounds; -database->CryptoAlgorithmus=ComboAlgo->currentItem(); +database->CryptoAlgorithmus=ComboAlgo->currentIndex(); done(1); } diff --git a/src/dialogs/DatabaseSettingsDlg.h b/src/dialogs/DatabaseSettingsDlg.h index 524fdd5..8421b4b 100755 --- a/src/dialogs/DatabaseSettingsDlg.h +++ b/src/dialogs/DatabaseSettingsDlg.h @@ -30,7 +30,7 @@ class CDbSettingsDlg : public QDialog, public Ui_dbsettingdlg_base Q_OBJECT public: - CDbSettingsDlg(QWidget* parent,Database* db,const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); + CDbSettingsDlg(QWidget* parent,Database* db, bool modal = FALSE, Qt::WFlags fl = 0 ); ~CDbSettingsDlg(); virtual void showEvent(QShowEvent *); /*$PUBLIC_FUNCTIONS$*/ diff --git a/src/dialogs/EditEntryDlg.cpp b/src/dialogs/EditEntryDlg.cpp index 4f1b023..574d55d 100755 --- a/src/dialogs/EditEntryDlg.cpp +++ b/src/dialogs/EditEntryDlg.cpp @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -35,7 +35,6 @@ #include #include #include -//Added by qt3to4: #include #include "SelectIconDlg.h" @@ -44,8 +43,8 @@ -CEditEntryDlg::CEditEntryDlg(Database* _db, CEntry* _entry,QWidget* parent, const char* name, bool modal, Qt::WFlags fl) -: QDialog(parent,name, modal,fl) +CEditEntryDlg::CEditEntryDlg(Database* _db, CEntry* _entry,QWidget* parent, bool modal, Qt::WFlags fl) +: QDialog(parent,fl) { Q_ASSERT(_db); Q_ASSERT(_entry); @@ -74,8 +73,8 @@ ButtonSaveAttachment->setIcon(*Icon_FileSave); if(entry->BinaryData.isNull()){ ButtonSaveAttachment->setDisabled(true); ButtonDeleteAttachment->setDisabled(true);} -setCaption(entry->Title); -setIcon(db->icon(entry->ImageID)); +setWindowTitle(entry->Title); +setWindowIcon(db->icon(entry->ImageID)); Edit_Title->setText(entry->Title); Edit_UserName->setText(entry->UserName); Edit_URL->setText(entry->URL); @@ -92,7 +91,7 @@ if(bits>128) bits=128; Progress_Quali->setValue(100*bits/128); Edit_Attachment->setText(entry->BinaryDesc); -Edit_Comment->setText(entry->Additional); +Edit_Comment->setPlainText(entry->Additional); InitGroupComboBox(); InitIconComboBox(); if(entry->BinaryData.length()==0) @@ -136,9 +135,9 @@ if(event->spontaneous()==false){ void CEditEntryDlg::InitIconComboBox(){ for(int i=0;inumIcons();i++){ - Combo_IconPicker->insertItem(db->icon(i),"",i); + Combo_IconPicker->insertItem(i,db->icon(i),""); } - Combo_IconPicker->setCurrentItem(entry->ImageID); + Combo_IconPicker->setCurrentIndex(entry->ImageID); } @@ -148,10 +147,10 @@ int i; for(i=0;i!=db->numGroups();i++){ tmp=""; for(int j=0;jgroup(i).Level;j++)tmp+=" "; -Combo_Group->insertItem(db->icon(db->group(i).ImageID), - tmp+db->group(i).Name,i); +Combo_Group->insertItem(i,db->icon(db->group(i).ImageID), + tmp+db->group(i).Name); } -Combo_Group->setCurrentItem(db->getGroupIndex(entry->GroupID)); +Combo_Group->setCurrentIndex(db->getGroupIndex(entry->GroupID)); } void CEditEntryDlg::OnButtonOK() @@ -162,7 +161,7 @@ QMessageBox::warning(NULL,tr("Warning"),tr("Password and password repetition are return; } -if(CheckBox_ExpiresNever->state()==Qt::Checked){ +if(CheckBox_ExpiresNever->checkState()==Qt::Checked){ DateTime_Expire->setDateTime(Date_Never);} if(DateTime_Expire->dateTime()!=entry->Expire) @@ -173,13 +172,13 @@ if(entry->UserName!=Edit_UserName->text()) ModFlag=true; if(entry->URL!=Edit_URL->text()) ModFlag=true; -if(entry->Additional!=Edit_Comment->text()) +if(entry->Additional!=Edit_Comment->toPlainText()) ModFlag=true; entry->Password.unlock(); if(entry->Password.string()!=Edit_Password->text()) ModFlag=true; entry->Password.lock(); -if(entry->ImageID!=Combo_IconPicker->currentItem()) +if(entry->ImageID!=Combo_IconPicker->currentIndex()) ModFlag=true; entry->Expire=DateTime_Expire->dateTime(); @@ -190,14 +189,14 @@ entry->UserName=Edit_UserName->text(); entry->URL=Edit_URL->text(); QString s=Edit_Password->text(); entry->Password.setString(s,true); -entry->Additional=Edit_Comment->text(); -if(Combo_Group->currentItem()!=db->getGroupIndex(entry->GroupID)){ - db->moveEntry(entry,&db->group(Combo_Group->currentItem())); +entry->Additional=Edit_Comment->toPlainText(); +if(Combo_Group->currentIndex()!=db->getGroupIndex(entry->GroupID)){ + db->moveEntry(entry,&db->group(Combo_Group->currentIndex())); EntryMoved=true; ModFlag=true; } -if(entry->ImageIDcurrentItem()>=BUILTIN_ICONS) +if(entry->ImageIDcurrentIndex()>=BUILTIN_ICONS) entry->OldImgID=entry->ImageID; -entry->ImageID=Combo_IconPicker->currentItem(); +entry->ImageID=Combo_IconPicker->currentIndex(); if(ModFlag&&EntryMoved)done(2); else if(ModFlag)done(1); @@ -238,10 +237,15 @@ void CEditEntryDlg::OnPasswordwTextChanged(const QString& w) { if(QString::compare(Edit_Password_w->text(),Edit_Password->text().mid(0,(Edit_Password_w->text().length())))!=0){ -Edit_Password_w->setPaletteBackgroundColor(QColor(255,125,125)); + QPalette palette; + palette.setColor(Edit_Password_w->foregroundRole(),QColor(255,125,125)); + Edit_Password_w->setPalette(palette); }else { -Edit_Password_w->setPaletteBackgroundColor(QColor(255,255,255)); ///@FIXME Standard-Hintergrundfarbe nicht weiß +///@FIXME should set correct background color... it's not always white! + QPalette palette; + palette.setColor(Edit_Password_w->foregroundRole(),QColor(255,255,255)); + Edit_Password_w->setPalette(palette); } @@ -251,11 +255,16 @@ Edit_Password_w->setPaletteBackgroundColor(QColor(255,255,255)); ///@FIXME Stand void CEditEntryDlg::OnPasswordwLostFocus() { if(QString::compare(Edit_Password_w->text(),Edit_Password->text())!=0){ -Edit_Password_w->setPaletteBackgroundColor(QColor(255,125,125)); + QPalette palette; + palette.setColor(Edit_Password_w->foregroundRole(),QColor(255,125,125)); + Edit_Password_w->setPalette(palette); } else { -Edit_Password_w->setPaletteBackgroundColor(QColor(255,255,255)); ///@FIXME Standard-Hintergrundfarbe nicht weiß +///@FIXME should set correct background color... it's not always white! + QPalette palette; + palette.setColor(Edit_Password_w->foregroundRole(),QColor(255,255,255)); + Edit_Password_w->setPalette(palette); } @@ -263,7 +272,7 @@ Edit_Password_w->setPaletteBackgroundColor(QColor(255,255,255)); ///@FIXME Stand void CEditEntryDlg::OnNewAttachment() { -QString filename=QFileDialog::getOpenFileName(this,tr("Add Attachment..."),QDir::homeDirPath()); +QString filename=QFileDialog::getOpenFileName(this,tr("Add Attachment..."),QDir::homePath()); if(filename=="")return; QFile file(filename); if(file.open(QIODevice::ReadOnly)==false){ @@ -297,7 +306,7 @@ saveAttachment(entry,this); void CEditEntryDlg::saveAttachment(CEntry* pEntry, QWidget* ParentWidget) { -QFileDialog FileDlg(ParentWidget,tr("Save Attachment..."),QDir::homeDirPath()); +QFileDialog FileDlg(ParentWidget,tr("Save Attachment..."),QDir::homePath()); FileDlg.selectFile(pEntry->BinaryDesc); FileDlg.setAcceptMode(QFileDialog::AcceptSave); if(!FileDlg.exec())return; @@ -347,7 +356,7 @@ ButtonDeleteAttachment->setDisabled(true); void CEditEntryDlg::OnButtonGenPw() { -CGenPwDialog* pDlg=new CGenPwDialog(this,0,true); +CGenPwDialog* pDlg=new CGenPwDialog(this,true); pDlg->show(); } @@ -363,13 +372,13 @@ else } void CEditEntryDlg::OnCustomIcons(){ -CSelectIconDlg dlg(db,Combo_IconPicker->currentItem(),this); +CSelectIconDlg dlg(db,Combo_IconPicker->currentIndex(),this); int r=dlg.exec(); if(r!=-1){ Combo_IconPicker->clear(); for(int i=0;inumIcons();i++) - Combo_IconPicker->insertItem(db->icon(i),"",i); - Combo_IconPicker->setCurrentItem(r); + Combo_IconPicker->insertItem(i,db->icon(i),""); + Combo_IconPicker->setCurrentIndex(r); } } diff --git a/src/dialogs/EditEntryDlg.h b/src/dialogs/EditEntryDlg.h index cf984c5..75dfa42 100755 --- a/src/dialogs/EditEntryDlg.h +++ b/src/dialogs/EditEntryDlg.h @@ -31,7 +31,7 @@ class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog Q_OBJECT public: - CEditEntryDlg(Database* _db, CEntry* _entry,QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0); + CEditEntryDlg(Database* _db, CEntry* _entry,QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0); ~CEditEntryDlg(); virtual void showEvent(QShowEvent *); /*$PUBLIC_FUNCTIONS$*/ diff --git a/src/dialogs/EditGroupDlg.cpp b/src/dialogs/EditGroupDlg.cpp index db5c1c3..aa94311 100755 --- a/src/dialogs/EditGroupDlg.cpp +++ b/src/dialogs/EditGroupDlg.cpp @@ -27,8 +27,8 @@ #include "SelectIconDlg.h" -CEditGroupDialog::CEditGroupDialog(Database* database,QWidget* parent, const char* name, bool modal, Qt::WFlags fl) -: QDialog(parent,name, modal,fl) +CEditGroupDialog::CEditGroupDialog(Database* database,QWidget* parent, bool modal, Qt::WFlags fl) +: QDialog(parent,fl) { setupUi(this); db=database; @@ -47,16 +47,16 @@ void CEditGroupDialog::showEvent(QShowEvent *event){ if(event->spontaneous()==false){ EditTitle->setText(GroupName); for(int i=0;inumIcons();i++){ - ComboIconPicker->insertItem(db->icon(i),"",i); + ComboIconPicker->insertItem(i,db->icon(i),""); } - ComboIconPicker->setCurrentItem(IconID); + ComboIconPicker->setCurrentIndex(IconID); } } void CEditGroupDialog::OnOK() { GroupName=EditTitle->text(); -IconID=ComboIconPicker->currentItem(); +IconID=ComboIconPicker->currentIndex(); done(1); } @@ -72,8 +72,8 @@ int r=dlg.exec(); if(r!=-1){ ComboIconPicker->clear(); for(int i=0;inumIcons();i++) - ComboIconPicker->insertItem(db->icon(i),"",i); + ComboIconPicker->insertItem(i,db->icon(i),""); IconID=r; - ComboIconPicker->setCurrentItem(IconID); + ComboIconPicker->setCurrentIndex(IconID); } } diff --git a/src/dialogs/EditGroupDlg.h b/src/dialogs/EditGroupDlg.h index c2679e6..860f508 100755 --- a/src/dialogs/EditGroupDlg.h +++ b/src/dialogs/EditGroupDlg.h @@ -31,7 +31,7 @@ class CEditGroupDialog : public QDialog, public Ui_EditGroupDialog Q_OBJECT public: - CEditGroupDialog(Database*,QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); + CEditGroupDialog(Database*,QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); ~CEditGroupDialog(); bool ModFlag; virtual void showEvent(QShowEvent *event); diff --git a/src/dialogs/PasswordDlg.cpp b/src/dialogs/PasswordDlg.cpp index 28cec64..2f119dc 100755 --- a/src/dialogs/PasswordDlg.cpp +++ b/src/dialogs/PasswordDlg.cpp @@ -31,15 +31,15 @@ #include -CPasswordDialog::CPasswordDialog(QWidget* parent, const char* name, bool modal, bool ShowExitButton,bool ChangeKeyMode, Qt::WFlags fl) -: QDialog(parent,name, modal,fl) +CPasswordDialog::CPasswordDialog(QWidget* parent, bool modal, bool ShowExitButton,bool ChangeKeyMode, Qt::WFlags fl) +: QDialog(parent,fl) { setupUi(this); createBanner(Banner,Icon_Key32x32,tr("Database Key")); QDir media(config.MountDir); if(media.exists()){ QStringList Paths; - Paths=media.entryList("*",QDir::Dirs); + Paths=media.entryList(QStringList()<<"*",QDir::Dirs); Paths.erase(Paths.begin()); // delete "." Paths.erase(Paths.begin()); // delete ".." for(int i=0;isetEditText(filename); } @@ -179,7 +179,7 @@ if(KeyType==BOTH || KeyType==KEYFILE){ if(!file.exists()){ QDir dir(keyfile); QStringList files; - files=dir.entryList("*.key",QDir::Files); + files=dir.entryList(QStringList()<<"*.key",QDir::Files); if(!files.size()){ QMessageBox::warning(this,tr("Error"),tr("The given directory does not contain any key files."),tr("OK"),"","",0,0); return;} diff --git a/src/dialogs/PasswordDlg.h b/src/dialogs/PasswordDlg.h index 204549f..86efda2 100755 --- a/src/dialogs/PasswordDlg.h +++ b/src/dialogs/PasswordDlg.h @@ -38,7 +38,7 @@ QString keyfile; QString password; tKeyType KeyType; -CPasswordDialog(QWidget* parent = 0, const char* name = 0, bool modal = false, +CPasswordDialog(QWidget* parent = 0, bool modal = false, bool ShowExitButton = false, bool KeyMode_Set=false, Qt::WFlags fl = 0 ); public slots: diff --git a/src/dialogs/PasswordGenDlg.cpp b/src/dialogs/PasswordGenDlg.cpp index 6271601..b65f74e 100755 --- a/src/dialogs/PasswordGenDlg.cpp +++ b/src/dialogs/PasswordGenDlg.cpp @@ -27,8 +27,8 @@ #include #include -CGenPwDialog::CGenPwDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) -: QDialog(parent,name, modal,fl) +CGenPwDialog::CGenPwDialog(QWidget* parent, bool modal, Qt::WFlags fl) +: QDialog(parent,fl) { setupUi(this); createBanner(Banner,Icon_Key32x32,tr("Password Generator")); @@ -187,8 +187,9 @@ if(checkBox8->isChecked())bits=length*8; else bits=length*7; Label_Bits->setText(tr("%1 Bit").arg(QString::number(bits))); if(bits>128)bits=128; -Progress_Quali->setProgress(bits,128); -Progress_Quali->setPercentageVisible(false); +Progress_Quali->setRange(0,128); +Progress_Quali->setValue(bits); +Progress_Quali->setTextVisible(false); } int CGenPwDialog::AddToAssoctable(char* table,int start,int end,int pos){ diff --git a/src/dialogs/PasswordGenDlg.h b/src/dialogs/PasswordGenDlg.h index 90f39a5..342b1fb 100755 --- a/src/dialogs/PasswordGenDlg.h +++ b/src/dialogs/PasswordGenDlg.h @@ -32,7 +32,7 @@ private: int AddToAssoctable(char* table,int start,int end,int pos); bool trim(unsigned char &value,int range); public: - CGenPwDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); + CGenPwDialog(QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); ~CGenPwDialog(); /*$PUBLIC_FUNCTIONS$*/ diff --git a/src/dialogs/SearchDlg.cpp b/src/dialogs/SearchDlg.cpp index 4714fe6..b44c3a4 100755 --- a/src/dialogs/SearchDlg.cpp +++ b/src/dialogs/SearchDlg.cpp @@ -27,8 +27,8 @@ #include #include -CSearchDlg::CSearchDlg(Database* _db,CGroup* pGroup,QWidget* parent, const char* name, bool modal, Qt::WFlags fl) -: QDialog(parent,name, modal,fl) +CSearchDlg::CSearchDlg(Database* _db,CGroup* pGroup,QWidget* parent, bool modal, Qt::WFlags fl) +: QDialog(parent,fl) { setupUi(this); connect( Button_Search, SIGNAL( clicked() ), this, SLOT( OnButtonSearch() ) ); @@ -114,10 +114,10 @@ done(1); bool CSearchDlg::search(const QString& str){ if(regexp){ - QRegExp exp(txt,checkBox_Cs->isChecked()); + QRegExp exp(txt,checkBox_Cs->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive); if(str.contains(exp)==0)return false;} else{ - if(str.contains(txt,checkBox_Cs->isChecked())==0)return false;} + if(str.contains(txt,checkBox_Cs->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive)==0)return false;} return true; } diff --git a/src/dialogs/SearchDlg.h b/src/dialogs/SearchDlg.h index ba561d8..f627e39 100755 --- a/src/dialogs/SearchDlg.h +++ b/src/dialogs/SearchDlg.h @@ -27,7 +27,7 @@ class CSearchDlg : public QDialog, public Ui_Search_Dlg { Q_OBJECT public: - CSearchDlg(Database* _db, CGroup* pGroup=NULL,QWidget* parent = 0, const char* name = 0, + CSearchDlg(Database* _db, CGroup* pGroup=NULL,QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); ~CSearchDlg(); QList Hits; diff --git a/src/dialogs/SelectIconDlg.cpp b/src/dialogs/SelectIconDlg.cpp index 2f1c71a..84975b9 100644 --- a/src/dialogs/SelectIconDlg.cpp +++ b/src/dialogs/SelectIconDlg.cpp @@ -28,7 +28,7 @@ -CSelectIconDlg::CSelectIconDlg(Database* database,int CurrentID,QWidget* parent,const char* name, bool modal, Qt::WFlags fl):QDialog(parent,name,modal,fl){ +CSelectIconDlg::CSelectIconDlg(Database* database,int CurrentID,QWidget* parent, bool modal, Qt::WFlags fl):QDialog(parent,fl){ setupUi(this); db=database; CtxMenu=new QMenu(this); @@ -122,4 +122,4 @@ done(-1); void CSelectIconDlg::OnSelectionChanged(QListWidgetItem* cur,QListWidgetItem* prev){ Button_PickIcon->setEnabled(cur); -} \ No newline at end of file +} diff --git a/src/dialogs/SelectIconDlg.h b/src/dialogs/SelectIconDlg.h index 7849534..ed9f981 100644 --- a/src/dialogs/SelectIconDlg.h +++ b/src/dialogs/SelectIconDlg.h @@ -31,7 +31,7 @@ class CSelectIconDlg:public QDialog, public Ui_SelectIconDlg{ Q_OBJECT public: - CSelectIconDlg(Database* db,int,QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WFlags fl = 0); + CSelectIconDlg(Database* db,int,QWidget* parent = 0, bool modal = false, Qt::WFlags fl = 0); public slots: void OnAddIcon(); @@ -54,4 +54,4 @@ protected: }; -#endif \ No newline at end of file +#endif diff --git a/src/dialogs/SimplePasswordDlg.cpp b/src/dialogs/SimplePasswordDlg.cpp index 9d27bcf..305b6ef 100755 --- a/src/dialogs/SimplePasswordDlg.cpp +++ b/src/dialogs/SimplePasswordDlg.cpp @@ -24,8 +24,8 @@ #include "PwmConfig.h" #include "SimplePasswordDlg.h" -CSimplePasswordDialog::CSimplePasswordDialog(QWidget* parent, const char* name, bool modal, Qt::WFlags fl) -: QDialog(parent,name, modal,fl) +CSimplePasswordDialog::CSimplePasswordDialog(QWidget* parent, bool modal, Qt::WFlags fl) +: QDialog(parent,fl) { setupUi(this); if(!config.ShowPasswords)Button_HidePassword->toggle(); diff --git a/src/dialogs/SimplePasswordDlg.h b/src/dialogs/SimplePasswordDlg.h index adb95a3..fc88c80 100755 --- a/src/dialogs/SimplePasswordDlg.h +++ b/src/dialogs/SimplePasswordDlg.h @@ -28,7 +28,7 @@ class CSimplePasswordDialog : public QDialog, public Ui_SimplePasswordDialog Q_OBJECT public: - CSimplePasswordDialog(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); + CSimplePasswordDialog(QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); ~CSimplePasswordDialog(); /*$PUBLIC_FUNCTIONS$*/ diff --git a/src/export/Export_Txt.cpp b/src/export/Export_Txt.cpp index dd1c2a5..f268f68 100644 --- a/src/export/Export_Txt.cpp +++ b/src/export/Export_Txt.cpp @@ -44,7 +44,7 @@ if(!file.open(QIODevice::Truncate | QIODevice::WriteOnly)){ } for(int g=0;gnumGroups();g++){ - file.write(GroupTemplate.arg(db->group(g).Name).utf8()); + file.write(GroupTemplate.arg(db->group(g).Name).toUtf8()); for(int e=0;enumEntries();e++){ if(db->group(g).ID==db->entry(e).GroupID){ db->entry(e).Password.unlock(); @@ -53,7 +53,7 @@ for(int g=0;gnumGroups();g++){ .arg(db->entry(e).URL) .arg(db->entry(e).Password.string()) .arg(db->entry(e).Additional.replace('\n',"\n ")) - .utf8()); + .toUtf8()); db->entry(e).Password.lock(); } } diff --git a/src/forms/DatabaseSettingsDlg.ui b/src/forms/DatabaseSettingsDlg.ui index 0283172..5139c6f 100644 --- a/src/forms/DatabaseSettingsDlg.ui +++ b/src/forms/DatabaseSettingsDlg.ui @@ -35,7 +35,7 @@ Database Settings - + 10 diff --git a/src/forms/EditEntryDlg.ui b/src/forms/EditEntryDlg.ui index 26bce2f..bbdaa39 100644 --- a/src/forms/EditEntryDlg.ui +++ b/src/forms/EditEntryDlg.ui @@ -275,7 +275,7 @@ - + @@ -394,15 +394,6 @@ - - - Q3TextEdit - -
q3textedit.h
- 0 - -
-
Combo_Group Combo_IconPicker diff --git a/src/forms/PasswordDlg.ui b/src/forms/PasswordDlg.ui index 04f6f87..97ed2b1 100644 --- a/src/forms/PasswordDlg.ui +++ b/src/forms/PasswordDlg.ui @@ -114,7 +114,7 @@
- + 10 @@ -134,9 +134,6 @@ Key - - Qt::Vertical - @@ -321,15 +318,6 @@ - - - Q3GroupBox - -
Qt3Support/Q3GroupBox
- 1 - -
-
Edit_Password Edit_PasswordRep diff --git a/src/forms/PasswordGenDlg.ui b/src/forms/PasswordGenDlg.ui index 76a89cd..f863899 100644 --- a/src/forms/PasswordGenDlg.ui +++ b/src/forms/PasswordGenDlg.ui @@ -35,7 +35,7 @@ Password Generator - + 130 @@ -165,7 +165,7 @@ QFrame::Sunken - + 10 diff --git a/src/forms/SearchDlg.ui b/src/forms/SearchDlg.ui index cc94b2f..438a705 100644 --- a/src/forms/SearchDlg.ui +++ b/src/forms/SearchDlg.ui @@ -106,7 +106,7 @@ true - + 10 @@ -118,9 +118,6 @@ Include: - - Qt::Vertical - @@ -271,15 +268,6 @@ - - - Q3GroupBox - -
Qt3Support/Q3GroupBox
- 1 - -
-
Edit_Search checkBox_Cs diff --git a/src/forms/SettingsDlg.ui b/src/forms/SettingsDlg.ui index bd4ffbc..aa153c1 100644 --- a/src/forms/SettingsDlg.ui +++ b/src/forms/SettingsDlg.ui @@ -176,7 +176,7 @@ Appea&rance - + 20 @@ -578,15 +578,6 @@ - - - Q3GroupBox - -
Qt3Support/Q3GroupBox
- 1 - -
-
tabWidget4 SpinBox_ClipboardTime diff --git a/src/import/Import_KWalletXml.cpp b/src/import/Import_KWalletXml.cpp index 9a3ffea..5f191e0 100755 --- a/src/import/Import_KWalletXml.cpp +++ b/src/import/Import_KWalletXml.cpp @@ -38,14 +38,14 @@ if(len==0){ err+=QObject::tr("File is empty."); return false;} quint8* buffer=new quint8[len]; -file.readBlock((char*)buffer,len); +file.read((char*)buffer,len); file.close(); QDomDocument doc; QString xmlerr; int col,line; if(!doc.setContent(QString::fromUtf8((char*)buffer,len),false,&xmlerr,&line,&col)){ - cout << "Import_PwManager::parseXmlContent():" << endl; - cout << (xmlerr+" (Line:%1 Column:%2)").arg(line).arg(col).ascii() << endl; + qWarning("Import_PwManager::parseXmlContent():\n"); + qWarning(((xmlerr+" (Line:%1 Column:%2)").arg(line).arg(col)+QString('\n')).toAscii()); err+=QObject::tr("Invalid XML file (see stdout for details)."); delete [] buffer; return false;} diff --git a/src/import/Import_PwManager.cpp b/src/import/Import_PwManager.cpp index 26b7258..51f12e5 100755 --- a/src/import/Import_PwManager.cpp +++ b/src/import/Import_PwManager.cpp @@ -37,7 +37,7 @@ if(!file.exists()){err+=QObject::tr("File not found."); return false;} if(!file.open(QIODevice::ReadOnly)){err+=QObject::tr("Could not open file."); return false;} if(len=file.size()) buffer=new char[len]; else {err+=QObject::tr("File is empty."); return false;} -file.readBlock(buffer,len); +file.read(buffer,len); file.close(); if(QString::fromAscii(buffer,17)!="PWM_PASSWORD_FILE") {err+=QObject::tr("File is no valid PwManager file."); return false;} @@ -76,7 +76,7 @@ int pwlen=password.length(); byte* Key=new byte[pwlen]; byte* xml=new byte[len-offset+1]; xml[len-offset]=0; -memcpy(Key,password.ascii(),pwlen); +memcpy(Key,password.toAscii(),pwlen); char* key_hash=new char[20]; CSHA1 sha; sha.Update(Key,pwlen); @@ -116,8 +116,8 @@ QDomDocument db; QString err; int col,line; if(!db.setContent(QString::fromUtf8(content,strlen(content)-1),false,&err,&line,&col)){ - cout << "Import_PwManager::parseXmlContent():" << endl; - cout << (err+" (Line:%1 Column:%2)").arg(line).arg(col).ascii() << endl; + qWarning("Import_PwManager::parseXmlContent():\n"); + qWarning(((err+" (Line:%1 Column:%2)").arg(line).arg(col)+QString('\n')).toAscii()); return false;} QDomElement root=db.documentElement(); if(root.tagName()!="P")return false; diff --git a/src/lib/AutoType_X11.cpp b/src/lib/AutoType_X11.cpp index e7d7d9b..3d4d0d7 100644 --- a/src/lib/AutoType_X11.cpp +++ b/src/lib/AutoType_X11.cpp @@ -97,7 +97,7 @@ for(int i=0;ifont(0)); -painter.drawPixmap(0,0,DragItems[0]->icon(0).pixmap()); +painter.drawPixmap(0,0,DragItems[0]->icon(0).pixmap(QSize(16,16))); painter.drawText(19,DragPixmHeight-fontmet.strikeOutPos(),DragText); QMimeData *mimeData = new QMimeData; void* pDragItems=&DragItems; diff --git a/src/lib/GroupView.cpp b/src/lib/GroupView.cpp index 73ffffa..a76d68a 100644 --- a/src/lib/GroupView.cpp +++ b/src/lib/GroupView.cpp @@ -196,7 +196,7 @@ void KeepassGroupView::mouseMoveEvent(QMouseEvent *event){ QPainter painter(&DragPixmap); painter.setPen(QColor(0,0,0)); painter.setFont(DragItem->font(0)); - painter.drawPixmap(0,0,DragItem->icon(0).pixmap()); + painter.drawPixmap(0,0,DragItem->icon(0).pixmap(QSize(16,16))); painter.drawText(19,DragPixmHeight-fontmet.strikeOutPos(),DragItem->text(0)); QMimeData *mimeData = new QMimeData; mimeData->setData("keepass/group",QByteArray((char*)&(DragItem->pGroup),sizeof(void*))); diff --git a/src/lib/UrlLabel.cpp b/src/lib/UrlLabel.cpp index 0ca125d..9e8883e 100755 --- a/src/lib/UrlLabel.cpp +++ b/src/lib/UrlLabel.cpp @@ -21,17 +21,20 @@ #include "UrlLabel.h" #include "main.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include +#include -LinkLabel::LinkLabel(QWidget *parent, const char* name,const QString& text, int x, int y,Qt::WFlags f) : QLabel(parent,name,f){ +LinkLabel::LinkLabel(QWidget *parent,const QString& text, int x, int y,Qt::WFlags f) : QLabel(parent,f){ QFont font(parentWidget()->font()); font.setUnderline(true); setFont(font); -setPaletteForegroundColor(QColor(20,20,255)); +QPalette palette; +palette.setColor(foregroundRole(),QColor(20,20,255)); +setPalette(palette); setCursor(Qt::PointingHandCursor); setText(text); setPos(x,y); diff --git a/src/lib/UrlLabel.h b/src/lib/UrlLabel.h index 5c6e91f..de3da2d 100755 --- a/src/lib/UrlLabel.h +++ b/src/lib/UrlLabel.h @@ -20,14 +20,13 @@ #ifndef _LINKLABEL_H_ #define _LINKLABEL_H_ -#include -#include +#include #include class LinkLabel : public QLabel{ Q_OBJECT public: -LinkLabel(QWidget *parent, const char* name = 0,const QString& text=QString::null, int x=0, int y=0,Qt::WFlags f=0); +LinkLabel(QWidget *parent,const QString& text=QString::null, int x=0, int y=0,Qt::WFlags f=0); ~LinkLabel(); void setPos(int x,int y); QString url(); diff --git a/src/main.cpp b/src/main.cpp index 3f35123..a51f1f7 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -88,12 +88,12 @@ parseCmdLineArgs(argc,argv,ArgFile,ArgCfg,ArgLang); AppDir=app->applicationDirPath(); //Load Config if(ArgCfg==QString()){ - if(!QDir(QDir::homeDirPath()+"/.keepass").exists()){ - QDir conf(QDir::homeDirPath()); + if(!QDir(QDir::homePath()+"/.keepass").exists()){ + QDir conf(QDir::homePath()); if(!conf.mkdir(".keepass")){ cout << "Warning: Could not create directory '~/.keepass'." << endl;} } - IniFilename=QDir::homeDirPath()+"/.keepass/config"; + IniFilename=QDir::homePath()+"/.keepass/config"; config.loadFromIni(IniFilename); } else{ @@ -117,11 +117,11 @@ bool TrFound=true; QString locname; if(!translator->load("keepass-"+loc.name(),app->applicationDirPath()+"/../share/keepass/i18n/")){ - if(!translator->load("keepass-"+loc.name(),QDir::homeDirPath()+"/.keepass/")){ + if(!translator->load("keepass-"+loc.name(),QDir::homePath()+"/.keepass/")){ if(loc.name()!="en_US") qWarning(QString("KeePassX: No Translation found language '%1 (%2)' using 'English (UnitedStates)'") .arg(QLocale::languageToString(loc.language())) - .arg(QLocale::countryToString(loc.country()))); + .arg(QLocale::countryToString(loc.country())).toAscii()); TrFound=false; } } @@ -136,7 +136,7 @@ if(!qtTranslator->load("qt_"+loc.name().left(2),QLibraryInfo::location(QLibraryI if(loc.name()!="en_US") qWarning(QString("Qt: No Translation found for '%1 (%2)'using 'English (UnitedStates)'") .arg(QLocale::languageToString(loc.language())) - .arg(QLocale::countryToString(loc.country()))); + .arg(QLocale::countryToString(loc.country())).toAscii()); delete qtTranslator; }else{ app->installTranslator(qtTranslator); @@ -218,7 +218,7 @@ Banner->setPixmap(*banner_pixmap); void openBrowser(QString url){ QProcess browser; -QStringList args=QStringList::split(' ',config.OpenUrlCommand.arg(url)); +QStringList args=config.OpenUrlCommand.arg(url).split(' '); QString cmd=args.takeFirst(); browser.startDetached(cmd,args); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1fc6f84..6ff1aad 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -278,8 +278,8 @@ Q_ASSERT(!FileOpen); if(!IsAuto){ config.LastKeyLocation=QString(); config.LastKeyType=PASSWORD;} -CPasswordDialog PasswordDlg(this,"Password Dialog",true,IsAuto); -PasswordDlg.setCaption(filename); +CPasswordDialog PasswordDlg(this,true,IsAuto); +PasswordDlg.setWindowTitle(filename); int r=PasswordDlg.exec(); if(r==0) return; if(r==2) {Start=false; return;} @@ -299,7 +299,7 @@ StatusBarGeneral->setText(tr("Loading Database...")); if(db->openDatabase(filename,err)==true){ //SUCCESS if(config.OpenLast)config.LastFile=filename; -setCaption(tr("KeePassX - %1").arg(filename)); +setWindowTitle(tr("KeePassX - %1").arg(filename)); GroupView->updateItems(); EntryView->updateItems(0); setStateFileOpen(true); @@ -338,14 +338,14 @@ GroupView->Items.clear(); SearchResults.clear(); GroupView->ShowSearchGroup=false; setStateFileOpen(false); -setCaption("KeePassX Password Manager"); +setWindowTitle("KeePassX Password Manager"); return true; } void KeepassMainWindow::OnFileNew(){ -CPasswordDialog dlg(this,"PasswordDlg",true,false,true); -dlg.setCaption("New Database"); +CPasswordDialog dlg(this,true,false,true); +dlg.setWindowTitle("New Database"); if(dlg.exec()==1){ if(FileOpen) if(!closeDatabase())return; @@ -364,7 +364,7 @@ if(dlg.exec()==1){ db->CalcMasterKeyByFile(dlg.keyfile); if(dlg.password!="" && dlg.keyfile!="") db->CalcMasterKeyByFileAndPw(dlg.keyfile,dlg.password); - setCaption(tr("KeePassX - %1").arg(tr("[new]"))); + setWindowTitle(tr("KeePassX - %1").arg(tr("[new]"))); GroupView->db=db; EntryView->db=db; GroupView->updateItems(); @@ -427,7 +427,7 @@ else{ } void KeepassMainWindow::editEntry(CEntry* pEntry){ -CEditEntryDlg dlg(db,pEntry,this,"EditEntryDialog",true); +CEditEntryDlg dlg(db,pEntry,this,true); switch(dlg.exec()){ case 0: //canceled or no changes break; @@ -480,7 +480,7 @@ default: Q_ASSERT(false); void KeepassMainWindow::updateDetailView(){ if(EntryView->selectedItems().size()!=1){ - DetailView->setText(""); + DetailView->setPlainText(""); return;} CEntry& entry=*((EntryViewItem*)(EntryView->selectedItems()[0]))->pEntry; @@ -614,18 +614,18 @@ Q_ASSERT(db->file); if(db->file->isOpen()) db->file->close(); db->file->setFileName(filename); -setCaption(tr("KeePassX - %1").arg(filename)); +setWindowTitle(tr("KeePassX - %1").arg(filename)); return OnFileSave(); } void KeepassMainWindow::OnFileSettings(){ -CDbSettingsDlg dlg(this,db,"DatabaseSettingsDlg"); +CDbSettingsDlg dlg(this,db); if(dlg.exec())setStateFileModified(true); } void KeepassMainWindow::OnFileChangeKey(){ -CPasswordDialog dlg(this,"PasswordDlg",true,false,true); -dlg.setCaption(db->file->fileName()); +CPasswordDialog dlg(this,true,false,true); +dlg.setWindowTitle(db->file->fileName()); if(dlg.exec()==1){ if(dlg.KeyType==BOTH || dlg.KeyType==KEYFILE){ if(!db->createKeyFile(dlg.keyfile)){ @@ -664,7 +664,7 @@ if(filename!=QString::null){ Q_ASSERT(!FileOpen); db = new PwDatabase(); db->newDatabase(); - CSimplePasswordDialog dlg(this,"SimplePasswordDlg",true); + CSimplePasswordDialog dlg(this,true); if(!dlg.exec()){ delete db; db=NULL; @@ -677,7 +677,7 @@ if(filename!=QString::null){ Import_PwManager import; if(import.importFile(filename,dlg.password,db,err)==true){ //SUCCESS - setCaption(tr("KeePassX [new]")); + setWindowTitle(tr("KeePassX [new]")); GroupView->updateItems(); EntryView->updateItems(0); setStateFileOpen(true); @@ -711,7 +711,7 @@ if(filename!=QString::null){ Import_KWalletXml import; if(import.importFile(filename,db,err)==true){ //SUCCESS - setCaption(tr("KeePassX [new]")); + setWindowTitle(tr("KeePassX [new]")); GroupView->updateItems(); EntryView->updateItems(0); setStateFileOpen(true); @@ -792,7 +792,7 @@ if(GroupView->selectedItems().size()) pNew=db->addGroup(static_cast(GroupView->selectedItems()[0])->pGroup); else pNew=db->addGroup(NULL); -CEditGroupDialog dlg(db,this,"EditGroupDlg",true); +CEditGroupDialog dlg(db,this,true); if(!dlg.exec()){ db->deleteGroup(pNew); return; @@ -806,7 +806,7 @@ GroupView->updateItems(); void KeepassMainWindow::OnEditEditGroup(){ Q_ASSERT(GroupView->selectedItems().size()); CGroup *pGroup=static_cast(GroupView->selectedItems()[0])->pGroup; -CEditGroupDialog dlg(db,this,"EditGroupDlg",true); +CEditGroupDialog dlg(db,this,true); dlg.GroupName=pGroup->Name; dlg.IconID=pGroup->ImageID; if(!dlg.exec())return; @@ -831,7 +831,7 @@ setStateFileModified(true); void KeepassMainWindow::OnEditNewEntry(){ CEntry NewEntry; NewEntry.GroupID=currentGroup()->ID; -CEditEntryDlg dlg(db,&NewEntry,this,"EditEntryDialog",true); +CEditEntryDlg dlg(db,&NewEntry,this,true); if(dlg.exec()){ db->addEntry(&NewEntry); EntryView->updateItems(currentGroup()->ID); @@ -879,13 +879,15 @@ for(int i=0; isetText(currentEntry()->UserName, QClipboard::Clipboard); -ClipboardTimer.start(config.ClipboardTimeOut*1000,true); +ClipboardTimer.setSingleShot(true); +ClipboardTimer.start(config.ClipboardTimeOut*1000); } void KeepassMainWindow::OnEditPasswordToClipboard(){ currentEntry()->Password.unlock(); Clipboard->setText(currentEntry()->Password.string(),QClipboard::Clipboard); -ClipboardTimer.start(config.ClipboardTimeOut*1000,true); +ClipboardTimer.setSingleShot(true); +ClipboardTimer.start(config.ClipboardTimeOut*1000); currentEntry()->Password.lock(); } @@ -1006,7 +1008,7 @@ CGroup::UI_ExpandByDefault=config.ExpandGroupTree; } void KeepassMainWindow::OnHelpAbout(){ -CAboutDialog dlg(this,"AboutDlg"); +CAboutDialog dlg(this); dlg.exec(); } diff --git a/src/src.pro b/src/src.pro index f32ba80..9dab186 100755 --- a/src/src.pro +++ b/src/src.pro @@ -115,7 +115,7 @@ SOURCES += lib/IniReader.cpp \ lib/EntryView.cpp \ crypto/arcfour.cpp \ lib/KpFileIconProvider.cpp -QT += xml qt3support +QT += xml MOC_DIR = ../build/moc UI_DIR = ../build/ui OBJECTS_DIR = ../build/