made password dialog working, moved key file creation from KeepassMainWindow to CPasswordDlg
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@121 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
		
							parent
							
								
									d5ed360fce
								
							
						
					
					
						commit
						6a8c2114eb
					
				| 
						 | 
					@ -227,6 +227,8 @@ This is the common base interface for databases. Every database class must imple
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
class IDatabase{
 | 
					class IDatabase{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
						virtual ~IDatabase(){};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//! Loads a database.
 | 
						//! Loads a database.
 | 
				
			||||||
   	/*! It is not allowed to call this function if a database is already loaded.
 | 
					   	/*! It is not allowed to call this function if a database is already loaded.
 | 
				
			||||||
		\param  identifier Normally this is the filename of the database but it can also be an IP address or something else if the database is not file based.
 | 
							\param  identifier Normally this is the filename of the database but it can also be an IP address or something else if the database is not file based.
 | 
				
			||||||
| 
						 | 
					@ -385,8 +387,8 @@ public:
 | 
				
			||||||
class IFilePasswordAuth{
 | 
					class IFilePasswordAuth{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	virtual void authByPwd(QString& password)=0;
 | 
						virtual void authByPwd(QString& password)=0;
 | 
				
			||||||
	virtual bool authByFile(QFile& file)=0;
 | 
						virtual bool authByFile(QString& filename)=0;
 | 
				
			||||||
	virtual bool authByFileAndPwd(QString& password, QFile& file)=0;
 | 
						virtual bool authByFileAndPwd(QString& password, QString& filename)=0;
 | 
				
			||||||
	/*! Creates a key file.
 | 
						/*! Creates a key file.
 | 
				
			||||||
		\param filename Filename of the new key file.
 | 
							\param filename Filename of the new key file.
 | 
				
			||||||
		\param length Length of the key file.
 | 
							\param length Length of the key file.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,103 +38,113 @@ using namespace std;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool CConfig::loadFromIni(QString filename){
 | 
					bool CConfig::loadFromIni(QString filename){
 | 
				
			||||||
QString defaultSearchOptions = "001101111";
 | 
						QString defaultSearchOptions = "001101111";
 | 
				
			||||||
QString defaultPwGenOptions = "1111100001";
 | 
						QString defaultPwGenOptions = "1111100001";
 | 
				
			||||||
ini.SetPath((const char*)filename.toUtf8());
 | 
						ini.SetPath((const char*)filename.toUtf8());
 | 
				
			||||||
ini.ReadFile();
 | 
						ini.ReadFile();
 | 
				
			||||||
ClipboardTimeOut=ini.GetValueI("Options","ClipboardTimeOut",20);
 | 
						ClipboardTimeOut=ini.GetValueI("Options","ClipboardTimeOut",20);
 | 
				
			||||||
Toolbar=ini.GetValueB("UI","ShowToolbar",true);
 | 
						Toolbar=ini.GetValueB("UI","ShowToolbar",true);
 | 
				
			||||||
EntryDetails=ini.GetValueB("UI","ShowEntryDetails",true);
 | 
						EntryDetails=ini.GetValueB("UI","ShowEntryDetails",true);
 | 
				
			||||||
OpenLast=ini.GetValueB("Options","RememberLastFile",true);
 | 
						OpenLast=ini.GetValueB("Options","RememberLastFile",true);
 | 
				
			||||||
LastFile=ini.GetValue("Options","LastFile","").c_str();
 | 
						LastFile=ini.GetValue("Options","LastFile","").c_str();
 | 
				
			||||||
ParseColumnString(ini.GetValue("UI","Columns","1111100000").c_str(),Columns);
 | 
						ParseColumnString(ini.GetValue("UI","Columns","1111100000").c_str(),Columns);
 | 
				
			||||||
BannerColor1=ParseColorString(ini.GetValue("Options","BannerColor1","0,85,127").c_str());
 | 
						BannerColor1=ParseColorString(ini.GetValue("Options","BannerColor1","0,85,127").c_str());
 | 
				
			||||||
BannerColor2=ParseColorString(ini.GetValue("Options","BannerColor2","0,117,175").c_str());
 | 
						BannerColor2=ParseColorString(ini.GetValue("Options","BannerColor2","0,117,175").c_str());
 | 
				
			||||||
BannerTextColor=ParseColorString(ini.GetValue("Options","BannerTextColor","222,222,222").c_str());
 | 
						BannerTextColor=ParseColorString(ini.GetValue("Options","BannerTextColor","222,222,222").c_str());
 | 
				
			||||||
ShowPasswords=ini.GetValueB("Options","ShowPasswords",false);
 | 
						ShowPasswords=ini.GetValueB("Options","ShowPasswords",false);
 | 
				
			||||||
OpenUrlCommand=ini.GetValue("Options","UrlCmd","kfmclient openURL %1").c_str();
 | 
						OpenUrlCommand=ini.GetValue("Options","UrlCmd","kfmclient openURL %1").c_str();
 | 
				
			||||||
Language=ini.GetValue("Options","LangFile","").c_str();
 | 
						Language=ini.GetValue("Options","LangFile","").c_str();
 | 
				
			||||||
ParseBoolString(ini.GetValue("Options","SearchOptions",(const char*)defaultSearchOptions.toUtf8()).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_HidePasswords=ini.GetValueB("UI","HidePasswords",true);
 | 
				
			||||||
ListView_HideUsernames=ini.GetValueB("UI","HideUsernames",false);
 | 
						ListView_HideUsernames=ini.GetValueB("UI","HideUsernames",false);
 | 
				
			||||||
ParseBoolString(ini.GetValue("Options","PwGenOptions",(const char*)defaultPwGenOptions.toUtf8()).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);
 | 
						PwGenLength=ini.GetValueI("Options","PwGenLength",25);
 | 
				
			||||||
PwGenCharList=ini.GetValue("Options","PwGenCharList","").c_str();
 | 
						PwGenCharList=ini.GetValue("Options","PwGenCharList","").c_str();
 | 
				
			||||||
ExpandGroupTree=ini.GetValueB("Options","ExpandGroupTree",true);
 | 
						ExpandGroupTree=ini.GetValueB("Options","ExpandGroupTree",true);
 | 
				
			||||||
MainWinHeight=ini.GetValueI("UI","MainWinHeight",550);
 | 
						MainWinHeight=ini.GetValueI("UI","MainWinHeight",550);
 | 
				
			||||||
MainWinWidth=ini.GetValueI("UI","MainWinWidth",900);
 | 
						MainWinWidth=ini.GetValueI("UI","MainWinWidth",900);
 | 
				
			||||||
MainWinSplit1=ini.GetValueI("UI","MainWinSplit1",100);
 | 
						MainWinSplit1=ini.GetValueI("UI","MainWinSplit1",100);
 | 
				
			||||||
MainWinSplit2=ini.GetValueI("UI","MainWinSplit2",300);
 | 
						MainWinSplit2=ini.GetValueI("UI","MainWinSplit2",300);
 | 
				
			||||||
ParseIntString(ini.GetValue("UI","ColumnSizes","15,10,10,10,10,10,10,10,10,10").c_str(),ColumnSizes,10);
 | 
						ParseIntString(ini.GetValue("UI","ColumnSizes","15,10,10,10,10,10,10,10,10,10").c_str(),ColumnSizes,10);
 | 
				
			||||||
ShowStatusbar=ini.GetValueB("UI","ShowStatusbar",true);
 | 
						ShowStatusbar=ini.GetValueB("UI","ShowStatusbar",true);
 | 
				
			||||||
AlternatingRowColors=ini.GetValueB("Options","AlternatingRowColors",true);
 | 
						AlternatingRowColors=ini.GetValueB("Options","AlternatingRowColors",true);
 | 
				
			||||||
MountDir=ini.GetValue("Options","MountDir",DEFAULT_MOUNT_DIR).c_str();
 | 
						MountDir=ini.GetValue("Options","MountDir",DEFAULT_MOUNT_DIR).c_str();
 | 
				
			||||||
RememberLastKey=ini.GetValueB("Options","RememberLastKey",true);
 | 
						RememberLastKey=ini.GetValueB("Options","RememberLastKey",true);
 | 
				
			||||||
LastKeyLocation=ini.GetValue("Options","LastKeyLocation","").c_str();
 | 
						LastKeyLocation=ini.GetValue("Options","LastKeyLocation","").c_str();
 | 
				
			||||||
LastKeyType=(tKeyType)ini.GetValueI("Options","LastKeyType",(int)PASSWORD);
 | 
						LastKeyType=(tKeyType)ini.GetValueI("Options","LastKeyType",(int)PASSWORD);	
 | 
				
			||||||
if(!OpenLast)RememberLastKey=false;
 | 
						if(!OpenLast)RememberLastKey=false;
 | 
				
			||||||
ToolbarIconSize=ini.GetValueI("UI","ToolbarIconSize",16);
 | 
						ToolbarIconSize=ini.GetValueI("UI","ToolbarIconSize",16);
 | 
				
			||||||
 | 
						ShowSysTrayIcon=ini.GetValueB("Options","ShowSysTrayIcon",false);
 | 
				
			||||||
QString IntegrPluginVal=ini.GetValue("Options","IntegrPlugin","None").c_str();
 | 
						MinimizeToTray=ini.GetValueB("Options","MinimizeToTray",false);
 | 
				
			||||||
if(IntegrPluginVal=="None")	
 | 
						SaveFileDlgHistory=ini.GetValueB("Options","SaveFileDlgHistory",true);
 | 
				
			||||||
 | 
						EnableBookmarkMenu=ini.GetValueB("Options","EnableBookmarkMenu",true);
 | 
				
			||||||
 | 
						GroupTreeRestore=ini.GetValueI("Options","GroupTreeRestore",1);
 | 
				
			||||||
 | 
						QString IntegrPluginVal=ini.GetValue("Options","IntegrPlugin","None").c_str();
 | 
				
			||||||
 | 
						if(IntegrPluginVal=="None")	
 | 
				
			||||||
		IntegrPlugin=NONE;
 | 
							IntegrPlugin=NONE;
 | 
				
			||||||
else if(IntegrPluginVal=="Gnome")
 | 
						else if(IntegrPluginVal=="Gnome")
 | 
				
			||||||
		IntegrPlugin=GNOME;
 | 
							IntegrPlugin=GNOME;
 | 
				
			||||||
else if(IntegrPluginVal=="KDE")
 | 
						else if(IntegrPluginVal=="KDE")
 | 
				
			||||||
		IntegrPlugin=KDE;
 | 
							IntegrPlugin=KDE;
 | 
				
			||||||
else
 | 
						else
 | 
				
			||||||
		IntegrPlugin=NONE;
 | 
							IntegrPlugin=NONE;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool CConfig::saveToIni(QString filename){
 | 
					bool CConfig::saveToIni(QString filename){
 | 
				
			||||||
ini.SetValueI("Options","ClipboardTimeOut",ClipboardTimeOut);
 | 
						ini.SetValueI("Options","ClipboardTimeOut",ClipboardTimeOut);
 | 
				
			||||||
ini.SetValueB("UI","ShowToolbar",Toolbar);
 | 
						ini.SetValueB("UI","ShowToolbar",Toolbar);
 | 
				
			||||||
ini.SetValueB("UI","ShowEntryDetails",EntryDetails);
 | 
						ini.SetValueB("UI","ShowEntryDetails",EntryDetails);
 | 
				
			||||||
ini.SetValueB("Options","RememberLastFile",OpenLast);
 | 
						ini.SetValueB("Options","RememberLastFile",OpenLast);
 | 
				
			||||||
	 if(OpenLast)ini.SetValue("Options","LastFile",(const char*)LastFile.toUtf8());
 | 
						 if(OpenLast)ini.SetValue("Options","LastFile",(const char*)LastFile.toUtf8());
 | 
				
			||||||
	 else	     ini.SetValue("Options","LastFile","");
 | 
						 else	     ini.SetValue("Options","LastFile","");
 | 
				
			||||||
ini.SetValue("UI","Columns",(const char*)CreateColumnString().toUtf8(),true);
 | 
						ini.SetValue("UI","Columns",(const char*)CreateColumnString().toUtf8(),true);
 | 
				
			||||||
ini.SetValue("Options","BannerColor1",(const char*)CreateColorString(BannerColor1).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","BannerColor2",(const char*)CreateColorString(BannerColor2).toUtf8(),true);
 | 
				
			||||||
ini.SetValue("Options","BannerTextColor",(const char*)CreateColorString(BannerTextColor).toUtf8(),true);
 | 
						ini.SetValue("Options","BannerTextColor",(const char*)CreateColorString(BannerTextColor).toUtf8(),true);
 | 
				
			||||||
ini.SetValueB("Options","ShowPasswords",ShowPasswords,true);
 | 
						ini.SetValueB("Options","ShowPasswords",ShowPasswords,true);
 | 
				
			||||||
ini.SetValue("Options","UrlCmd",(const char*)OpenUrlCommand.toUtf8(),true);
 | 
						ini.SetValue("Options","UrlCmd",(const char*)OpenUrlCommand.toUtf8(),true);
 | 
				
			||||||
ini.SetValue("Options","LangFile",(const char*)Language.toUtf8(),true);
 | 
						ini.SetValue("Options","LangFile",(const char*)Language.toUtf8(),true);
 | 
				
			||||||
ini.SetValue("Options","SearchOptions",(const char*)CreateBoolString(SearchOptions,9).toUtf8(),true);
 | 
						ini.SetValue("Options","SearchOptions",(const char*)CreateBoolString(SearchOptions,9).toUtf8(),true);
 | 
				
			||||||
ini.SetValueB("UI","HidePasswords",ListView_HidePasswords);
 | 
						ini.SetValueB("UI","HidePasswords",ListView_HidePasswords);
 | 
				
			||||||
ini.SetValueB("UI","HideUsernames",ListView_HideUsernames);
 | 
						ini.SetValueB("UI","HideUsernames",ListView_HideUsernames);
 | 
				
			||||||
ini.SetValue("Options","PwGenOptions",(const char*)CreateBoolString(PwGenOptions,10).toUtf8(),true);
 | 
						ini.SetValue("Options","PwGenOptions",(const char*)CreateBoolString(PwGenOptions,10).toUtf8(),true);
 | 
				
			||||||
ini.SetValueI("Options","PwGenLength",PwGenLength,true);
 | 
						ini.SetValueI("Options","PwGenLength",PwGenLength,true);
 | 
				
			||||||
ini.SetValue("Options","PwGenCharList",(const char*)PwGenCharList.toUtf8(),true);
 | 
						ini.SetValue("Options","PwGenCharList",(const char*)PwGenCharList.toUtf8(),true);
 | 
				
			||||||
ini.SetValueB("Options","ExpandGroupTree",ExpandGroupTree,true);
 | 
						ini.SetValueB("Options","ExpandGroupTree",ExpandGroupTree,true);
 | 
				
			||||||
ini.SetValueI("UI","MainWinHeight",MainWinHeight);
 | 
						ini.SetValueI("UI","MainWinHeight",MainWinHeight);
 | 
				
			||||||
ini.SetValueI("UI","MainWinWidth",MainWinWidth);
 | 
						ini.SetValueI("UI","MainWinWidth",MainWinWidth);
 | 
				
			||||||
ini.SetValueI("UI","MainWinSplit1",MainWinSplit1);
 | 
						ini.SetValueI("UI","MainWinSplit1",MainWinSplit1);
 | 
				
			||||||
ini.SetValueI("UI","MainWinSplit2",MainWinSplit2);
 | 
						ini.SetValueI("UI","MainWinSplit2",MainWinSplit2);
 | 
				
			||||||
ini.SetValue("UI","ColumnSizes",(const char*)CreateIntString(ColumnSizes,10).toUtf8(),true);
 | 
						ini.SetValue("UI","ColumnSizes",(const char*)CreateIntString(ColumnSizes,10).toUtf8(),true);
 | 
				
			||||||
ini.SetValueB("UI","ShowStatusbar",ShowStatusbar);
 | 
						ini.SetValueB("UI","ShowStatusbar",ShowStatusbar);
 | 
				
			||||||
ini.SetValueB("Options","AlternatingRowColors",AlternatingRowColors);
 | 
						ini.SetValueB("Options","AlternatingRowColors",AlternatingRowColors);
 | 
				
			||||||
ini.SetValue("Options","MountDir",(const char*)MountDir.toUtf8());
 | 
						ini.SetValue("Options","MountDir",(const char*)MountDir.toUtf8());
 | 
				
			||||||
ini.SetValueB("Options","RememberLastKey",RememberLastKey);
 | 
						ini.SetValueB("Options","RememberLastKey",RememberLastKey);
 | 
				
			||||||
if(RememberLastKey){
 | 
						ini.SetValueB("Options","ShowSysTrayIcon",ShowSysTrayIcon);
 | 
				
			||||||
 | 
						ini.SetValueB("Options","MinimizeToTray",MinimizeToTray);
 | 
				
			||||||
 | 
						ini.SetValueB("Options","SaveFileDlgHistory",SaveFileDlgHistory);
 | 
				
			||||||
 | 
						ini.SetValueB("Options","EnableBookmarkMenu",EnableBookmarkMenu);
 | 
				
			||||||
 | 
						ini.SetValueI("Options","GroupTreeRestore",GroupTreeRestore);	
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if(RememberLastKey){
 | 
				
			||||||
		ini.SetValue("Options","LastKeyLocation",(const char*)LastKeyLocation.toUtf8());
 | 
							ini.SetValue("Options","LastKeyLocation",(const char*)LastKeyLocation.toUtf8());
 | 
				
			||||||
		ini.SetValueI("Options","LastKeyType",LastKeyType);}
 | 
							ini.SetValueI("Options","LastKeyType",LastKeyType);}
 | 
				
			||||||
else{
 | 
						else{
 | 
				
			||||||
		ini.SetValue("Options","LastKeyLocation","");
 | 
							ini.SetValue("Options","LastKeyLocation","");
 | 
				
			||||||
		ini.SetValueI("Options","LastKeyType",0);}
 | 
							ini.SetValueI("Options","LastKeyType",0);}
 | 
				
			||||||
ini.SetValueI("UI","ToolbarIconSize",ToolbarIconSize,true);
 | 
						ini.SetValueI("UI","ToolbarIconSize",ToolbarIconSize,true);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
if(IntegrPlugin==NONE)
 | 
						if(IntegrPlugin==NONE)
 | 
				
			||||||
		ini.SetValue("Options","IntegrPlugin","None");
 | 
							ini.SetValue("Options","IntegrPlugin","None");
 | 
				
			||||||
if(IntegrPlugin==GNOME)
 | 
						if(IntegrPlugin==GNOME)
 | 
				
			||||||
		ini.SetValue("Options","IntegrPlugin","Gnome");
 | 
							ini.SetValue("Options","IntegrPlugin","Gnome");
 | 
				
			||||||
if(IntegrPlugin==KDE)
 | 
						if(IntegrPlugin==KDE)
 | 
				
			||||||
		ini.SetValue("Options","IntegrPlugin","KDE");
 | 
							ini.SetValue("Options","IntegrPlugin","KDE");
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
if(!ini.WriteFile())return false;
 | 
						if(!ini.WriteFile())return false;
 | 
				
			||||||
else return true;
 | 
						else return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CConfig::ParseColumnString(QString str, bool* dst){
 | 
					void CConfig::ParseColumnString(QString str, bool* dst){
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,52 +20,57 @@
 | 
				
			||||||
#ifndef _PWMCONFIG_H_
 | 
					#ifndef _PWMCONFIG_H_
 | 
				
			||||||
#define _PWMCONFIG_H_
 | 
					#define _PWMCONFIG_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QColor>
 | 
				
			||||||
#include "main.h"
 | 
					#include "main.h"
 | 
				
			||||||
#include "lib/IniReader.h"
 | 
					#include "lib/IniReader.h"
 | 
				
			||||||
#include <qcolor.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
class CConfig{
 | 
					class CConfig{
 | 
				
			||||||
public:
 | 
						public:
 | 
				
			||||||
enum IntegrPluginType{NONE,KDE,GNOME};
 | 
						enum IntegrPluginType{NONE,KDE,GNOME};
 | 
				
			||||||
		int TimeFormat;
 | 
							int TimeFormat;
 | 
				
			||||||
		int ClipboardTimeOut;
 | 
							int ClipboardTimeOut;
 | 
				
			||||||
 bool Toolbar;
 | 
					 | 
				
			||||||
 bool EntryDetails;
 | 
					 | 
				
			||||||
 QString LastFile;
 | 
					 | 
				
			||||||
 bool OpenLast;
 | 
					 | 
				
			||||||
 bool Columns[10];
 | 
					 | 
				
			||||||
 QColor BannerColor1;
 | 
					 | 
				
			||||||
 QColor BannerColor2;
 | 
					 | 
				
			||||||
 QColor BannerTextColor;
 | 
					 | 
				
			||||||
 bool ShowPasswords;
 | 
					 | 
				
			||||||
 QString OpenUrlCommand;
 | 
					 | 
				
			||||||
 QString Language;
 | 
					 | 
				
			||||||
 bool SearchOptions[9];
 | 
					 | 
				
			||||||
 bool ListView_HidePasswords;
 | 
					 | 
				
			||||||
 bool ListView_HideUsernames;
 | 
					 | 
				
			||||||
 bool PwGenOptions[10];
 | 
					 | 
				
			||||||
 int PwGenLength;
 | 
					 | 
				
			||||||
 QString PwGenCharList;
 | 
					 | 
				
			||||||
 bool ExpandGroupTree;
 | 
					 | 
				
			||||||
 bool EnableKdePlugin;
 | 
					 | 
				
			||||||
		int MainWinHeight;
 | 
							int MainWinHeight;
 | 
				
			||||||
		int MainWinWidth;
 | 
							int MainWinWidth;
 | 
				
			||||||
		int MainWinSplit1;
 | 
							int MainWinSplit1;
 | 
				
			||||||
		int MainWinSplit2;
 | 
							int MainWinSplit2;
 | 
				
			||||||
 | 
							int ToolbarIconSize;
 | 
				
			||||||
 | 
							int PwGenLength;
 | 
				
			||||||
 | 
							int GroupTreeRestore; // 0:Restore Last; 1:Expand All; 2:Don't Expand
 | 
				
			||||||
		int ColumnSizes[10];
 | 
							int ColumnSizes[10];
 | 
				
			||||||
 | 
							bool Toolbar;
 | 
				
			||||||
 | 
							bool EntryDetails;
 | 
				
			||||||
 | 
							bool OpenLast;		
 | 
				
			||||||
 | 
							bool ListView_HidePasswords;
 | 
				
			||||||
 | 
							bool ListView_HideUsernames;
 | 
				
			||||||
 | 
							bool SearchOptions[9];
 | 
				
			||||||
 | 
							bool PwGenOptions[10];
 | 
				
			||||||
 | 
							bool Columns[10];
 | 
				
			||||||
 | 
							bool ShowPasswords;
 | 
				
			||||||
 | 
							bool ExpandGroupTree;
 | 
				
			||||||
 | 
							bool EnableKdePlugin;
 | 
				
			||||||
		bool ShowStatusbar;
 | 
							bool ShowStatusbar;
 | 
				
			||||||
		bool AlternatingRowColors;
 | 
							bool AlternatingRowColors;
 | 
				
			||||||
 QString MountDir;
 | 
					 | 
				
			||||||
		bool RememberLastKey;
 | 
							bool RememberLastKey;
 | 
				
			||||||
 tKeyType LastKeyType;
 | 
							bool ShowSysTrayIcon;
 | 
				
			||||||
 | 
							bool MinimizeToTray;
 | 
				
			||||||
 | 
							bool SaveFileDlgHistory;
 | 
				
			||||||
 | 
							bool EnableBookmarkMenu;
 | 
				
			||||||
 | 
							QString PwGenCharList;
 | 
				
			||||||
 | 
							QString MountDir;
 | 
				
			||||||
		QString LastKeyLocation;
 | 
							QString LastKeyLocation;
 | 
				
			||||||
 int ToolbarIconSize;
 | 
							QString OpenUrlCommand;
 | 
				
			||||||
 | 
							QString Language;
 | 
				
			||||||
 | 
							QString LastFile;		
 | 
				
			||||||
 | 
							QColor BannerColor1;
 | 
				
			||||||
 | 
							QColor BannerColor2;
 | 
				
			||||||
 | 
							QColor BannerTextColor;		
 | 
				
			||||||
		IntegrPluginType IntegrPlugin;
 | 
							IntegrPluginType IntegrPlugin;
 | 
				
			||||||
 | 
							tKeyType LastKeyType;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		bool loadFromIni(QString filename);
 | 
							bool loadFromIni(QString filename);
 | 
				
			||||||
		bool saveToIni(QString filename);
 | 
							bool saveToIni(QString filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
						private:
 | 
				
			||||||
		CIniFile ini;
 | 
							CIniFile ini;
 | 
				
			||||||
		void ParseColumnString(QString str, bool* dst);
 | 
							void ParseColumnString(QString str, bool* dst);
 | 
				
			||||||
		void ParseBoolString(const QString &str,const QString &defaults,bool* dst, int count);
 | 
							void ParseBoolString(const QString &str,const QString &defaults,bool* dst, int count);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -666,7 +666,12 @@ void StandardDatabase::authByPwd(QString& Password){
 | 
				
			||||||
	return;	
 | 
						return;	
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool StandardDatabase::authByFile(QFile& file){	
 | 
					bool StandardDatabase::authByFile(QString& filename){
 | 
				
			||||||
 | 
						QFile file(filename);
 | 
				
			||||||
 | 
						if(!file.open(QIODevice::ReadOnly|QIODevice::Unbuffered)){
 | 
				
			||||||
 | 
							error=decodeFileError(file.error());
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	unsigned long FileSize=file.size();	
 | 
						unsigned long FileSize=file.size();	
 | 
				
			||||||
	if(FileSize == 0){
 | 
						if(FileSize == 0){
 | 
				
			||||||
		error=tr("Key file is empty.");
 | 
							error=tr("Key file is empty.");
 | 
				
			||||||
| 
						 | 
					@ -674,14 +679,14 @@ bool StandardDatabase::authByFile(QFile& file){
 | 
				
			||||||
	}	
 | 
						}	
 | 
				
			||||||
	if(FileSize == 32){
 | 
						if(FileSize == 32){
 | 
				
			||||||
		if(file.read((char*)RawMasterKey,32) != 32){
 | 
							if(file.read((char*)RawMasterKey,32) != 32){
 | 
				
			||||||
			error=tr("Error while reading key file.");
 | 
								error=decodeFileError(file.error());
 | 
				
			||||||
			return false;}
 | 
								return false;}
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	}	
 | 
						}	
 | 
				
			||||||
	if(FileSize == 64){
 | 
						if(FileSize == 64){
 | 
				
			||||||
		char hex[64];
 | 
							char hex[64];
 | 
				
			||||||
		if(file.read(hex,64) != 64){
 | 
							if(file.read(hex,64) != 64){
 | 
				
			||||||
			error=tr("Error while reading key file.");
 | 
								error=decodeFileError(file.error());
 | 
				
			||||||
			return false;}
 | 
								return false;}
 | 
				
			||||||
		if(convHexToBinaryKey(hex,(char*)RawMasterKey))return true;
 | 
							if(convHexToBinaryKey(hex,(char*)RawMasterKey))return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -699,10 +704,10 @@ bool StandardDatabase::authByFile(QFile& file){
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool StandardDatabase::authByFileAndPwd(QString& Password, QFile& file){
 | 
					bool StandardDatabase::authByFileAndPwd(QString& Password, QString& filename){
 | 
				
			||||||
	unsigned char PasswordKey[32];
 | 
						unsigned char PasswordKey[32];
 | 
				
			||||||
	unsigned char FileKey[32];
 | 
						unsigned char FileKey[32];
 | 
				
			||||||
	if(!authByFile(file))return false;
 | 
						if(!authByFile(filename))return false;
 | 
				
			||||||
	memcpy(FileKey,RawMasterKey,32);
 | 
						memcpy(FileKey,RawMasterKey,32);
 | 
				
			||||||
	authByPwd(Password);
 | 
						authByPwd(Password);
 | 
				
			||||||
	memcpy(PasswordKey,RawMasterKey,32);
 | 
						memcpy(PasswordKey,RawMasterKey,32);
 | 
				
			||||||
| 
						 | 
					@ -711,6 +716,7 @@ bool StandardDatabase::authByFileAndPwd(QString& Password, QFile& file){
 | 
				
			||||||
	sha.update(PasswordKey,32);
 | 
						sha.update(PasswordKey,32);
 | 
				
			||||||
	sha.update(FileKey,32);
 | 
						sha.update(FileKey,32);
 | 
				
			||||||
	sha.finish(RawMasterKey);
 | 
						sha.finish(RawMasterKey);
 | 
				
			||||||
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QList<IEntryHandle*> StandardDatabase::entries(){
 | 
					QList<IEntryHandle*> StandardDatabase::entries(){
 | 
				
			||||||
| 
						 | 
					@ -1511,6 +1517,7 @@ bool StandardDatabase::createKeyFile(const QString& filename,int length, bool He
 | 
				
			||||||
	}	
 | 
						}	
 | 
				
			||||||
	file.close();
 | 
						file.close();
 | 
				
			||||||
	delete [] key;
 | 
						delete [] key;
 | 
				
			||||||
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -139,6 +139,7 @@ public:
 | 
				
			||||||
			QList<StdGroup*> Childs;
 | 
								QList<StdGroup*> Childs;
 | 
				
			||||||
			QList<StdEntry*> Entries;
 | 
								QList<StdEntry*> Entries;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
						virtual ~StandardDatabase(){};
 | 
				
			||||||
	virtual bool load(QString identifier);
 | 
						virtual bool load(QString identifier);
 | 
				
			||||||
	virtual bool save();
 | 
						virtual bool save();
 | 
				
			||||||
	virtual bool close();
 | 
						virtual bool close();
 | 
				
			||||||
| 
						 | 
					@ -155,8 +156,8 @@ public:
 | 
				
			||||||
	virtual void replaceIcon(int index,const QPixmap& icon);
 | 
						virtual void replaceIcon(int index,const QPixmap& icon);
 | 
				
			||||||
	virtual int builtinIcons(){return 62;};
 | 
						virtual int builtinIcons(){return 62;};
 | 
				
			||||||
	virtual void authByPwd(QString& password);
 | 
						virtual void authByPwd(QString& password);
 | 
				
			||||||
	virtual bool authByFile(QFile& file);
 | 
						virtual bool authByFile(QString& filename);
 | 
				
			||||||
	virtual bool authByFileAndPwd(QString& password, QFile& file);
 | 
						virtual bool authByFileAndPwd(QString& password, QString& filename);
 | 
				
			||||||
	virtual bool createKeyFile(const QString& filename,int length=32, bool Hex=false);
 | 
						virtual bool createKeyFile(const QString& filename,int length=32, bool Hex=false);
 | 
				
			||||||
	virtual QList<IEntryHandle*> search(IGroupHandle* Group,const QString& SearchString, bool CaseSensitve, bool RegExp,bool Recursive,bool* Fields);
 | 
						virtual QList<IEntryHandle*> search(IGroupHandle* Group,const QString& SearchString, bool CaseSensitve, bool RegExp,bool Recursive,bool* Fields);
 | 
				
			||||||
	virtual QFile* file(){return File;}
 | 
						virtual QFile* file(){return File;}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,23 +31,24 @@
 | 
				
			||||||
#include <QMessageBox>
 | 
					#include <QMessageBox>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CPasswordDialog::CPasswordDialog(QWidget* parent,  bool modal, bool ShowExitButton,bool ChangeKeyMode, Qt::WFlags fl)
 | 
					CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButton,bool ChangeKeyMode)
 | 
				
			||||||
: QDialog(parent,fl)
 | 
					: QDialog(parent)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
setupUi(this);
 | 
						setupUi(this);
 | 
				
			||||||
createBanner(Banner,Icon_Key32x32,tr("Database Key"));
 | 
						createBanner(Banner,Icon_Key32x32,tr("Database Key"));
 | 
				
			||||||
QDir media(config.MountDir);
 | 
						db=DB;
 | 
				
			||||||
if(media.exists()){
 | 
						QDir media(config.MountDir);
 | 
				
			||||||
 | 
						if(media.exists()){
 | 
				
			||||||
		QStringList Paths;
 | 
							QStringList Paths;
 | 
				
			||||||
		Paths=media.entryList(QStringList()<<"*",QDir::Dirs);
 | 
							Paths=media.entryList(QStringList()<<"*",QDir::Dirs);
 | 
				
			||||||
		Paths.erase(Paths.begin()); // delete "."
 | 
							Paths.erase(Paths.begin()); // delete "."
 | 
				
			||||||
		Paths.erase(Paths.begin()); // delete ".."
 | 
							Paths.erase(Paths.begin()); // delete ".."
 | 
				
			||||||
		for(int i=0;i<Paths.count();i++)
 | 
							for(int i=0;i<Paths.count();i++)
 | 
				
			||||||
			Combo_Dirs->addItem(config.MountDir+Paths[i]);
 | 
								Combo_Dirs->addItem(config.MountDir+Paths[i]);
 | 
				
			||||||
}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
Combo_Dirs->setEditText(QString());
 | 
						Combo_Dirs->setEditText(QString());
 | 
				
			||||||
if(config.RememberLastKey && !ChangeKeyMode){
 | 
						if(config.RememberLastKey && !ChangeKeyMode){
 | 
				
			||||||
		switch(config.LastKeyType){
 | 
							switch(config.LastKeyType){
 | 
				
			||||||
			//case PASSWORD:	setStatePasswordOnly(); break; //Password-Only is already the default
 | 
								//case PASSWORD:	setStatePasswordOnly(); break; //Password-Only is already the default
 | 
				
			||||||
			case KEYFILE:	setStateKeyFileOnly();
 | 
								case KEYFILE:	setStateKeyFileOnly();
 | 
				
			||||||
| 
						 | 
					@ -58,67 +59,69 @@ if(config.RememberLastKey && !ChangeKeyMode){
 | 
				
			||||||
							Combo_Dirs->setEditText(config.LastKeyLocation);
 | 
												Combo_Dirs->setEditText(config.LastKeyLocation);
 | 
				
			||||||
							break;
 | 
												break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						connect( Combo_Dirs, SIGNAL( editTextChanged(const QString&) ),this, SLOT( OnComboTextChanged(const QString&)));
 | 
				
			||||||
 | 
						connect( ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
 | 
				
			||||||
 | 
						connect( Edit_Password, SIGNAL( textChanged(const QString&) ), this, SLOT( OnPasswordChanged(const QString&) ) );
 | 
				
			||||||
 | 
						connect( CheckBox_Both, SIGNAL( stateChanged(int) ), this, SLOT( OnCheckBox_BothChanged(int) ) );
 | 
				
			||||||
 | 
						connect( ButtonChangeEchoMode, SIGNAL( clicked() ), this, SLOT( ChangeEchoMode() ) );
 | 
				
			||||||
 | 
						connect( Edit_Password, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
 | 
				
			||||||
 | 
						connect( Edit_PasswordRep, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
 | 
				
			||||||
 | 
						connect( ButtonExit, SIGNAL( clicked()),this,SLOT(OnButtonExit()));
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
connect( Combo_Dirs, SIGNAL( editTextChanged(const QString&) ),this, SLOT( OnComboTextChanged(const QString&)));
 | 
						ButtonExit->setVisible(ShowExitButton);
 | 
				
			||||||
connect( ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
 | 
						Mode_Set=ChangeKeyMode;
 | 
				
			||||||
connect( Edit_Password, SIGNAL( textChanged(const QString&) ), this, SLOT( OnPasswordChanged(const QString&) ) );
 | 
						if(!ChangeKeyMode){
 | 
				
			||||||
connect( CheckBox_Both, SIGNAL( stateChanged(int) ), this, SLOT( OnCheckBox_BothChanged(int) ) );
 | 
					 | 
				
			||||||
connect( ButtonChangeEchoMode, SIGNAL( clicked() ), this, SLOT( ChangeEchoMode() ) );
 | 
					 | 
				
			||||||
connect( Edit_Password, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
 | 
					 | 
				
			||||||
connect( Edit_PasswordRep, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
 | 
					 | 
				
			||||||
connect( ButtonExit, SIGNAL( clicked()),this,SLOT(OnButtonExit()));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ButtonExit->setVisible(ShowExitButton);
 | 
					 | 
				
			||||||
Mode_Set=ChangeKeyMode;
 | 
					 | 
				
			||||||
if(!ChangeKeyMode){
 | 
					 | 
				
			||||||
		Edit_PasswordRep->hide();
 | 
							Edit_PasswordRep->hide();
 | 
				
			||||||
		Label_PasswordRep->hide();
 | 
							Label_PasswordRep->hide();
 | 
				
			||||||
		connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK() ) );
 | 
							connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK() ) );
 | 
				
			||||||
		connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse() ) );
 | 
							connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse() ) );
 | 
				
			||||||
}else{
 | 
						}else{
 | 
				
			||||||
		connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK_Set() ) );
 | 
							connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK_Set() ) );
 | 
				
			||||||
		connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse_Set() ) );
 | 
							connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse_Set() ) );
 | 
				
			||||||
}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
if(!config.ShowPasswords)ChangeEchoMode();
 | 
						if(!config.ShowPasswords)ChangeEchoMode();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CPasswordDialog::setStatePasswordOnly(){
 | 
					void CPasswordDialog::setStatePasswordOnly(){
 | 
				
			||||||
Combo_Dirs->setEnabled(false);
 | 
						Combo_Dirs->setEnabled(false);
 | 
				
			||||||
ButtonBrowse->setEnabled(false);
 | 
						ButtonBrowse->setEnabled(false);
 | 
				
			||||||
Label_KeyFile->setEnabled(false);
 | 
						Label_KeyFile->setEnabled(false);
 | 
				
			||||||
Label_Password->setEnabled(true);
 | 
						Label_Password->setEnabled(true);
 | 
				
			||||||
Edit_Password->setEnabled(true);
 | 
						Label_PasswordRep->setEnabled(true);
 | 
				
			||||||
Edit_PasswordRep->setEnabled(true);
 | 
						Edit_Password->setEnabled(true);
 | 
				
			||||||
ButtonChangeEchoMode->setEnabled(true);
 | 
						Edit_PasswordRep->setEnabled(true);
 | 
				
			||||||
KeyType=PASSWORD;
 | 
						ButtonChangeEchoMode->setEnabled(true);
 | 
				
			||||||
 | 
						KeyType=PASSWORD;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CPasswordDialog::setStateKeyFileOnly(){
 | 
					void CPasswordDialog::setStateKeyFileOnly(){
 | 
				
			||||||
Combo_Dirs->setEnabled(true);
 | 
						Combo_Dirs->setEnabled(true);
 | 
				
			||||||
ButtonBrowse->setEnabled(true);
 | 
						ButtonBrowse->setEnabled(true);
 | 
				
			||||||
Label_KeyFile->setEnabled(true);
 | 
						Label_KeyFile->setEnabled(true);
 | 
				
			||||||
Label_Password->setEnabled(false);
 | 
						Label_Password->setEnabled(false);
 | 
				
			||||||
Edit_Password->setEnabled(false);
 | 
						Label_PasswordRep->setEnabled(false);
 | 
				
			||||||
Edit_PasswordRep->setEnabled(false);
 | 
						Edit_Password->setEnabled(false);
 | 
				
			||||||
ButtonChangeEchoMode->setEnabled(false);
 | 
						Edit_PasswordRep->setEnabled(false);
 | 
				
			||||||
KeyType=KEYFILE;
 | 
						ButtonChangeEchoMode->setEnabled(false);
 | 
				
			||||||
 | 
						KeyType=KEYFILE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CPasswordDialog::setStateBoth(){
 | 
					void CPasswordDialog::setStateBoth(){
 | 
				
			||||||
Combo_Dirs->setEnabled(true);
 | 
						Combo_Dirs->setEnabled(true);
 | 
				
			||||||
ButtonBrowse->setEnabled(true);
 | 
						ButtonBrowse->setEnabled(true);
 | 
				
			||||||
Label_KeyFile->setEnabled(true);
 | 
						Label_KeyFile->setEnabled(true);
 | 
				
			||||||
Label_Password->setEnabled(true);
 | 
						Label_Password->setEnabled(true);
 | 
				
			||||||
Edit_Password->setEnabled(true);
 | 
						Label_PasswordRep->setEnabled(true);
 | 
				
			||||||
Edit_PasswordRep->setEnabled(true);
 | 
						Edit_Password->setEnabled(true);
 | 
				
			||||||
ButtonChangeEchoMode->setEnabled(true);
 | 
						Edit_PasswordRep->setEnabled(true);
 | 
				
			||||||
KeyType=BOTH;
 | 
						ButtonChangeEchoMode->setEnabled(true);
 | 
				
			||||||
 | 
						KeyType=BOTH;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,7 +161,8 @@ void CPasswordDialog::OnOK(){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(password=="" && keyfile==""){
 | 
						if(password=="" && keyfile==""){
 | 
				
			||||||
		QMessageBox::warning(this,tr("Error"),tr("Please enter a Password or select a key file."),tr("OK"),"","",0,0);
 | 
							QMessageBox::warning(this,tr("Error"),tr("Please enter a Password or select a key file."),tr("OK"),"","",0,0);
 | 
				
			||||||
		return;}
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(KeyType==BOTH){
 | 
						if(KeyType==BOTH){
 | 
				
			||||||
		if(password==""){
 | 
							if(password==""){
 | 
				
			||||||
| 
						 | 
					@ -171,20 +175,6 @@ void CPasswordDialog::OnOK(){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(KeyType==BOTH || KeyType==KEYFILE){
 | 
						if(KeyType==BOTH || KeyType==KEYFILE){
 | 
				
			||||||
		QFileInfo fileinfo(keyfile);
 | 
							QFileInfo fileinfo(keyfile);
 | 
				
			||||||
			if(Mode_Set){
 | 
					 | 
				
			||||||
				if(fileinfo.exists()){
 | 
					 | 
				
			||||||
					switch(QMessageBox::question(this,tr("File exists."),tr("A file with the selected name already exists, should this file be used as key file\nor do you want to overwrite it with a new generated one?"),
 | 
					 | 
				
			||||||
						   tr("Use"),tr("Overwrite"),tr("Cancel"),0,2)){
 | 
					 | 
				
			||||||
						case 0: OverwriteKeyFile=false;
 | 
					 | 
				
			||||||
							   	break;
 | 
					 | 
				
			||||||
						case 1: OverwriteKeyFile=true;
 | 
					 | 
				
			||||||
								break;
 | 
					 | 
				
			||||||
						case 2:	return; 
 | 
					 | 
				
			||||||
					}					
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			else{				
 | 
					 | 
				
			||||||
		if(!fileinfo.exists()){
 | 
							if(!fileinfo.exists()){
 | 
				
			||||||
			QMessageBox::warning(this,tr("Error"),tr("The selected key file or directory does not exist."),tr("OK"),"","",0,0);
 | 
								QMessageBox::warning(this,tr("Error"),tr("The selected key file or directory does not exist."),tr("OK"),"","",0,0);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
| 
						 | 
					@ -212,13 +202,15 @@ void CPasswordDialog::OnOK(){
 | 
				
			||||||
					QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
 | 
										QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
 | 
				
			||||||
					return;}				
 | 
										return;}				
 | 
				
			||||||
				keyfile+=files[0];
 | 
									keyfile+=files[0];
 | 
				
			||||||
					}else{
 | 
									}
 | 
				
			||||||
 | 
								else{ /* pwsafe.key exists */
 | 
				
			||||||
				if(!QFileInfo(file).isReadable()){
 | 
									if(!QFileInfo(file).isReadable()){
 | 
				
			||||||
					QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
 | 
										QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
 | 
				
			||||||
					return;}			
 | 
										return;}			
 | 
				
			||||||
				keyfile+="pwsafe.key";
 | 
									keyfile+="pwsafe.key";
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				}else{
 | 
							}
 | 
				
			||||||
 | 
							else{ /* not a directory */
 | 
				
			||||||
			QFile file(keyfile);
 | 
								QFile file(keyfile);
 | 
				
			||||||
			if(!file.exists()){
 | 
								if(!file.exists()){
 | 
				
			||||||
				QMessageBox::warning(this,tr("Error"),tr("Key file could not be found."),tr("OK"),"","",0,0);
 | 
									QMessageBox::warning(this,tr("Error"),tr("Key file could not be found."),tr("OK"),"","",0,0);
 | 
				
			||||||
| 
						 | 
					@ -227,53 +219,71 @@ void CPasswordDialog::OnOK(){
 | 
				
			||||||
				QMessageBox::warning(this,tr("Error"),tr("Key file is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
 | 
									QMessageBox::warning(this,tr("Error"),tr("Key file is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
 | 
				
			||||||
				return;}
 | 
									return;}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
if(config.RememberLastKey){
 | 
						}
 | 
				
			||||||
	config.LastKeyLocation=keyfile;
 | 
					if(doAuth())done(1);
 | 
				
			||||||
	config.LastKeyType=KeyType;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
done(1);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CPasswordDialog::OnOK_Set(){
 | 
					void CPasswordDialog::OnOK_Set(){
 | 
				
			||||||
password=Edit_Password->text();
 | 
						password=Edit_Password->text();
 | 
				
			||||||
if(password!=Edit_PasswordRep->text()){
 | 
						if(password!=Edit_PasswordRep->text()){
 | 
				
			||||||
		QMessageBox::warning(this,tr("Warning"),tr("Password an password repetition are not equal.\nPlease check your input."),tr("OK"),"","",0,0);
 | 
							QMessageBox::warning(this,tr("Warning"),tr("Password an password repetition are not equal.\nPlease check your input."),tr("OK"),"","",0,0);
 | 
				
			||||||
	return;}
 | 
							return;
 | 
				
			||||||
keyfile=Combo_Dirs->currentText();
 | 
						}
 | 
				
			||||||
if(password=="" && keyfile==""){
 | 
						keyfile=Combo_Dirs->currentText();
 | 
				
			||||||
 | 
						if(password=="" && keyfile==""){
 | 
				
			||||||
		QMessageBox::warning(this,tr("Error"),tr("Please enter a password or select a key file."),tr("OK"),"","",0,0);
 | 
							QMessageBox::warning(this,tr("Error"),tr("Please enter a password or select a key file."),tr("OK"),"","",0,0);
 | 
				
			||||||
	return;}
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
QFile file(keyfile);
 | 
						if(keyfile!=QString()){	
 | 
				
			||||||
if(QFileInfo(file).isDir()){
 | 
					 | 
				
			||||||
	if(keyfile.right(1)!="/")keyfile+="/";
 | 
					 | 
				
			||||||
	QFile file(keyfile+"pwsafe.key");
 | 
					 | 
				
			||||||
	if(file.exists()){
 | 
					 | 
				
			||||||
		int r=QMessageBox::warning(this,tr("Warning"),tr("A file with the name 'pwsafe.key' already exisits in the given directory.\nDo you want to replace it?"),tr("Yes"),tr("No"),"",1,1);
 | 
					 | 
				
			||||||
		if(r)return;
 | 
					 | 
				
			||||||
		if(!QFileInfo(file).isWritable()){
 | 
					 | 
				
			||||||
			QMessageBox::warning(this,tr("Error"),tr("The exisiting file is not writable."),tr("OK"),"","",0,0);
 | 
					 | 
				
			||||||
			return;}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	keyfile+="pwsafe.key";
 | 
					 | 
				
			||||||
}else{
 | 
					 | 
				
			||||||
		QFile file(keyfile);
 | 
							QFile file(keyfile);
 | 
				
			||||||
	if(file.exists()){
 | 
							if(QFileInfo(file).isDir()){
 | 
				
			||||||
		int r=QMessageBox::warning(this,tr("Warning"),tr("A file with the this name already exisits.\nDo you want to replace it?"),tr("Yes"),tr("No"),"",1,1);
 | 
								if(keyfile.right(1)!="/")keyfile+="/";		
 | 
				
			||||||
		if(r)return;
 | 
								keyfile+="pwsafe.key";
 | 
				
			||||||
		if(!QFileInfo(file).isWritable()){
 | 
					 | 
				
			||||||
			QMessageBox::warning(this,tr("Error"),tr("The exisiting file is not writable."),tr("OK"),"","",0,0);
 | 
					 | 
				
			||||||
			return;}
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							if(file.exists()){
 | 
				
			||||||
 | 
								switch(QMessageBox::question(this,tr("File exists."),tr("A file with the selected name already exists, should this file be used as key file or do you want to overwrite it with a newly generated one?"),
 | 
				
			||||||
 | 
										tr("Use"),tr("Overwrite"),tr("Cancel"),0,2)){
 | 
				
			||||||
 | 
												case 0:
 | 
				
			||||||
 | 
													OverwriteKeyFile=false;
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
												case 1:
 | 
				
			||||||
 | 
													OverwriteKeyFile=true;
 | 
				
			||||||
 | 
													break;
 | 
				
			||||||
 | 
												case 2:
 | 
				
			||||||
 | 
													return; 
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}		
 | 
				
			||||||
 | 
							IFilePasswordAuth* DbAuth=dynamic_cast<IFilePasswordAuth*>(db);
 | 
				
			||||||
 | 
							if(OverwriteKeyFile){
 | 
				
			||||||
 | 
								if(!DbAuth->createKeyFile(keyfile,32,true)){
 | 
				
			||||||
 | 
									QMessageBox::warning(this,tr("Error"),tr("Key file could not be created.\n%1").arg(db->getError()),tr("OK"),"","",0,0);
 | 
				
			||||||
 | 
									return;
 | 
				
			||||||
 | 
								}		
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}		
 | 
				
			||||||
 | 
						if(doAuth())done(1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
if(config.RememberLastKey){
 | 
					
 | 
				
			||||||
 | 
					bool CPasswordDialog::doAuth(){
 | 
				
			||||||
 | 
						IFilePasswordAuth* DbAuth=dynamic_cast<IFilePasswordAuth*>(db);
 | 
				
			||||||
 | 
						if(password!=QString() && keyfile==QString()){
 | 
				
			||||||
 | 
							DbAuth->authByPwd(password);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if(password==QString() && keyfile!=QString()){
 | 
				
			||||||
 | 
							if(!DbAuth->authByFile(keyfile))return false;	
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if(password!=QString() && keyfile!=QString()){
 | 
				
			||||||
 | 
							if(!DbAuth->authByFile(keyfile))return false;	
 | 
				
			||||||
 | 
						}	
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if(config.RememberLastKey){
 | 
				
			||||||
		config.LastKeyLocation=keyfile;
 | 
							config.LastKeyLocation=keyfile;
 | 
				
			||||||
		config.LastKeyType=KeyType;
 | 
							config.LastKeyType=KeyType;
 | 
				
			||||||
}
 | 
						}
 | 
				
			||||||
done(1);
 | 
						return true;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CPasswordDialog::OnPasswordChanged(const QString &txt){
 | 
					void CPasswordDialog::OnPasswordChanged(const QString &txt){
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,32 +17,34 @@
 | 
				
			||||||
 *   Free Software Foundation, Inc.,                                       *
 | 
					 *   Free Software Foundation, Inc.,                                       *
 | 
				
			||||||
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 | 
					 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 | 
				
			||||||
 ***************************************************************************/
 | 
					 ***************************************************************************/
 | 
				
			||||||
#include "main.h"
 | 
					 | 
				
			||||||
#ifndef PASSWORDDIALOG_H
 | 
					#ifndef PASSWORDDIALOG_H
 | 
				
			||||||
#define PASSWORDDIALOG_H
 | 
					#define PASSWORDDIALOG_H
 | 
				
			||||||
#include "lib/UrlLabel.h"
 | 
					 | 
				
			||||||
#include "ui_PasswordDlg.h"
 | 
					#include "ui_PasswordDlg.h"
 | 
				
			||||||
 | 
					#include "main.h"
 | 
				
			||||||
 | 
					#include "lib/UrlLabel.h"
 | 
				
			||||||
 | 
					#include "Database.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class CPasswordDialog : public QDialog, public Ui_PasswordDlg
 | 
					class CPasswordDialog : public QDialog, public Ui_PasswordDlg
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 	Q_OBJECT
 | 
					 	Q_OBJECT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
						private:
 | 
				
			||||||
bool Mode_Set; //true = Set, false = Get
 | 
							bool Mode_Set; //true = Set, false = Get
 | 
				
			||||||
void setStatePasswordOnly();
 | 
							IDatabase* db;
 | 
				
			||||||
void setStateKeyFileOnly();
 | 
							void setStatePasswordOnly();
 | 
				
			||||||
void setStateBoth();
 | 
							void setStateKeyFileOnly();
 | 
				
			||||||
 | 
							void setStateBoth();
 | 
				
			||||||
 | 
							bool doAuth();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
public:
 | 
						public:
 | 
				
			||||||
QString keyfile;
 | 
							QString keyfile;
 | 
				
			||||||
QString password;
 | 
							QString password;
 | 
				
			||||||
tKeyType KeyType;
 | 
							tKeyType KeyType;
 | 
				
			||||||
bool OverwriteKeyFile;
 | 
							bool OverwriteKeyFile;	
 | 
				
			||||||
 | 
							CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButton = false, bool KeyMode_Set=false);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
CPasswordDialog(QWidget* parent = 0,  bool modal = false,
 | 
						public slots:
 | 
				
			||||||
								bool ShowExitButton = false, bool KeyMode_Set=false,  Qt::WFlags fl = 0 );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public slots:
 | 
					 | 
				
			||||||
	    void OnOK();
 | 
						    void OnOK();
 | 
				
			||||||
		void OnOK_Set();
 | 
							void OnOK_Set();
 | 
				
			||||||
	    void OnCancel();
 | 
						    void OnCancel();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,8 +74,22 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
 | 
				
			||||||
	color2=config.BannerColor2;
 | 
						color2=config.BannerColor2;
 | 
				
			||||||
	textcolor=config.BannerTextColor;
 | 
						textcolor=config.BannerTextColor;
 | 
				
			||||||
	CheckBox_ShowPasswords->setChecked(config.ShowPasswords);
 | 
						CheckBox_ShowPasswords->setChecked(config.ShowPasswords);
 | 
				
			||||||
 | 
						checkBox_ShowSysTrayIcon->setChecked(config.ShowSysTrayIcon);
 | 
				
			||||||
 | 
						checkBox_MinimizeToTray->setChecked(config.MinimizeToTray);
 | 
				
			||||||
 | 
						checkBox_SaveFileDlgHistory->setChecked(config.SaveFileDlgHistory);
 | 
				
			||||||
	Edit_BrowserCmd->setText(config.OpenUrlCommand);
 | 
						Edit_BrowserCmd->setText(config.OpenUrlCommand);
 | 
				
			||||||
//	CheckBox_ExpandGroupTree->setChecked(config.ExpandGroupTree);
 | 
					
 | 
				
			||||||
 | 
						switch(config.GroupTreeRestore){
 | 
				
			||||||
 | 
							case 1:
 | 
				
			||||||
 | 
								Radio_GroupTreeRestore->setChecked(true);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							case 2:
 | 
				
			||||||
 | 
								Radio_GroupTreeExpand->setChecked(true);
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							case 3:
 | 
				
			||||||
 | 
								Radio_GroupTreeDoNothing->setChecked(true);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	CheckBox_AlternatingRowColors->setChecked(config.AlternatingRowColors);
 | 
						CheckBox_AlternatingRowColors->setChecked(config.AlternatingRowColors);
 | 
				
			||||||
	Edit_MountDir->setText(config.MountDir);
 | 
						Edit_MountDir->setText(config.MountDir);
 | 
				
			||||||
	CheckBox_RememberLastKey->setChecked(config.RememberLastKey);
 | 
						CheckBox_RememberLastKey->setChecked(config.RememberLastKey);
 | 
				
			||||||
| 
						 | 
					@ -133,9 +147,17 @@ void CSettingsDlg::apply(){
 | 
				
			||||||
	config.BannerTextColor=textcolor;
 | 
						config.BannerTextColor=textcolor;
 | 
				
			||||||
	config.ShowPasswords=CheckBox_ShowPasswords->isChecked();
 | 
						config.ShowPasswords=CheckBox_ShowPasswords->isChecked();
 | 
				
			||||||
	config.OpenUrlCommand=Edit_BrowserCmd->text();
 | 
						config.OpenUrlCommand=Edit_BrowserCmd->text();
 | 
				
			||||||
//	config.ExpandGroupTree=CheckBox_ExpandGroupTree->isChecked();
 | 
					 | 
				
			||||||
	config.AlternatingRowColors=CheckBox_AlternatingRowColors->isChecked();
 | 
						config.AlternatingRowColors=CheckBox_AlternatingRowColors->isChecked();
 | 
				
			||||||
	config.MountDir=Edit_MountDir->text();
 | 
						config.MountDir=Edit_MountDir->text();
 | 
				
			||||||
 | 
						config.ShowSysTrayIcon=checkBox_ShowSysTrayIcon->isChecked();
 | 
				
			||||||
 | 
						config.MinimizeToTray=checkBox_MinimizeToTray->isChecked();
 | 
				
			||||||
 | 
						config.SaveFileDlgHistory=checkBox_SaveFileDlgHistory->isChecked();
 | 
				
			||||||
 | 
						config.EnableBookmarkMenu=checkBox_EnableBookmarkMenu->isChecked();
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if(Radio_GroupTreeRestore->isChecked())config.GroupTreeRestore=0;
 | 
				
			||||||
 | 
						if(Radio_GroupTreeExpand->isChecked())config.GroupTreeRestore=1;
 | 
				
			||||||
 | 
						if(Radio_GroupTreeDoNothing->isChecked())config.GroupTreeRestore=2;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	if(config.MountDir!="" && config.MountDir.right(1)!="/")
 | 
						if(config.MountDir!="" && config.MountDir.right(1)!="/")
 | 
				
			||||||
		config.MountDir+="/";
 | 
							config.MountDir+="/";
 | 
				
			||||||
	config.RememberLastKey=CheckBox_RememberLastKey->isChecked();
 | 
						config.RememberLastKey=CheckBox_RememberLastKey->isChecked();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,7 @@
 | 
				
			||||||
      <enum>QTabWidget::Rounded</enum>
 | 
					      <enum>QTabWidget::Rounded</enum>
 | 
				
			||||||
     </property>
 | 
					     </property>
 | 
				
			||||||
     <property name="currentIndex" >
 | 
					     <property name="currentIndex" >
 | 
				
			||||||
      <number>0</number>
 | 
					      <number>4</number>
 | 
				
			||||||
     </property>
 | 
					     </property>
 | 
				
			||||||
     <widget class="QWidget" name="tab" >
 | 
					     <widget class="QWidget" name="tab" >
 | 
				
			||||||
      <attribute name="title" >
 | 
					      <attribute name="title" >
 | 
				
			||||||
| 
						 | 
					@ -209,7 +209,7 @@
 | 
				
			||||||
        </widget>
 | 
					        </widget>
 | 
				
			||||||
       </item>
 | 
					       </item>
 | 
				
			||||||
       <item>
 | 
					       <item>
 | 
				
			||||||
        <widget class="QCheckBox" name="checkBox_4" >
 | 
					        <widget class="QCheckBox" name="checkBox_EnableBookmarkMenu" >
 | 
				
			||||||
         <property name="text" >
 | 
					         <property name="text" >
 | 
				
			||||||
          <string>Enable bookmark menu</string>
 | 
					          <string>Enable bookmark menu</string>
 | 
				
			||||||
         </property>
 | 
					         </property>
 | 
				
			||||||
| 
						 | 
					@ -276,7 +276,7 @@
 | 
				
			||||||
            </widget>
 | 
					            </widget>
 | 
				
			||||||
           </item>
 | 
					           </item>
 | 
				
			||||||
           <item>
 | 
					           <item>
 | 
				
			||||||
            <widget class="QRadioButton" name="Radion_GroupTreeDoNothing" >
 | 
					            <widget class="QRadioButton" name="Radio_GroupTreeDoNothing" >
 | 
				
			||||||
             <property name="text" >
 | 
					             <property name="text" >
 | 
				
			||||||
              <string>Do not expand any item</string>
 | 
					              <string>Do not expand any item</string>
 | 
				
			||||||
             </property>
 | 
					             </property>
 | 
				
			||||||
| 
						 | 
					@ -827,7 +827,7 @@
 | 
				
			||||||
     </widget>
 | 
					     </widget>
 | 
				
			||||||
     <widget class="QWidget" name="tab" >
 | 
					     <widget class="QWidget" name="tab" >
 | 
				
			||||||
      <attribute name="title" >
 | 
					      <attribute name="title" >
 | 
				
			||||||
       <string>&Other</string>
 | 
					       <string>Advanced</string>
 | 
				
			||||||
      </attribute>
 | 
					      </attribute>
 | 
				
			||||||
      <layout class="QVBoxLayout" >
 | 
					      <layout class="QVBoxLayout" >
 | 
				
			||||||
       <property name="margin" >
 | 
					       <property name="margin" >
 | 
				
			||||||
| 
						 | 
					@ -863,6 +863,13 @@
 | 
				
			||||||
           </property>
 | 
					           </property>
 | 
				
			||||||
          </widget>
 | 
					          </widget>
 | 
				
			||||||
         </item>
 | 
					         </item>
 | 
				
			||||||
 | 
					         <item row="1" column="0" >
 | 
				
			||||||
 | 
					          <widget class="QLabel" name="label_2" >
 | 
				
			||||||
 | 
					           <property name="text" >
 | 
				
			||||||
 | 
					            <string>Mounting Root:</string>
 | 
				
			||||||
 | 
					           </property>
 | 
				
			||||||
 | 
					          </widget>
 | 
				
			||||||
 | 
					         </item>
 | 
				
			||||||
         <item row="0" column="0" >
 | 
					         <item row="0" column="0" >
 | 
				
			||||||
          <widget class="QLabel" name="label" >
 | 
					          <widget class="QLabel" name="label" >
 | 
				
			||||||
           <property name="text" >
 | 
					           <property name="text" >
 | 
				
			||||||
| 
						 | 
					@ -876,13 +883,6 @@
 | 
				
			||||||
         <item row="0" column="1" >
 | 
					         <item row="0" column="1" >
 | 
				
			||||||
          <widget class="QLineEdit" name="Edit_BrowserCmd" />
 | 
					          <widget class="QLineEdit" name="Edit_BrowserCmd" />
 | 
				
			||||||
         </item>
 | 
					         </item>
 | 
				
			||||||
         <item row="1" column="0" >
 | 
					 | 
				
			||||||
          <widget class="QLabel" name="label_2" >
 | 
					 | 
				
			||||||
           <property name="text" >
 | 
					 | 
				
			||||||
            <string>Mounting Root:</string>
 | 
					 | 
				
			||||||
           </property>
 | 
					 | 
				
			||||||
          </widget>
 | 
					 | 
				
			||||||
         </item>
 | 
					 | 
				
			||||||
        </layout>
 | 
					        </layout>
 | 
				
			||||||
       </item>
 | 
					       </item>
 | 
				
			||||||
       <item>
 | 
					       <item>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -95,7 +95,6 @@ int main(int argc, char **argv)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	QString ArgFile,ArgCfg,ArgLang,IniFilename;
 | 
						QString ArgFile,ArgCfg,ArgLang,IniFilename;
 | 
				
			||||||
	QApplication* app=NULL;
 | 
						QApplication* app=NULL;
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	AppDir=QString(argv[0]);
 | 
						AppDir=QString(argv[0]);
 | 
				
			||||||
	AppDir.truncate(AppDir.lastIndexOf("/"));
 | 
						AppDir.truncate(AppDir.lastIndexOf("/"));
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,6 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt:
 | 
				
			||||||
  statusBar()->addWidget(StatusBarGeneral,15);
 | 
					  statusBar()->addWidget(StatusBarGeneral,15);
 | 
				
			||||||
  statusBar()->addWidget(StatusBarSelection,85);
 | 
					  statusBar()->addWidget(StatusBarSelection,85);
 | 
				
			||||||
  statusBar()->setVisible(config.ShowStatusbar);
 | 
					  statusBar()->setVisible(config.ShowStatusbar);
 | 
				
			||||||
//  Group::UI_ExpandByDefault=config.ExpandGroupTree;
 | 
					 | 
				
			||||||
  setupConnections();
 | 
					  setupConnections();
 | 
				
			||||||
  FileOpen=false;
 | 
					  FileOpen=false;
 | 
				
			||||||
  if(ArgFile!=QString())
 | 
					  if(ArgFile!=QString())
 | 
				
			||||||
| 
						 | 
					@ -202,6 +201,7 @@ void KeepassMainWindow::setupIcons(){
 | 
				
			||||||
	EditAutoTypeAction->setIcon(*Icon_AutoType);
 | 
						EditAutoTypeAction->setIcon(*Icon_AutoType);
 | 
				
			||||||
	HelpHandbookAction->setIcon(*Icon_Help);
 | 
						HelpHandbookAction->setIcon(*Icon_Help);
 | 
				
			||||||
	SysTray->setIcon(QIcon(AppDir+"/../share/keepass/icons/keepassx_large.png"));
 | 
						SysTray->setIcon(QIcon(AppDir+"/../share/keepass/icons/keepassx_large.png"));
 | 
				
			||||||
 | 
						if(config.ShowSysTrayIcon)
 | 
				
			||||||
		SysTray->show();	
 | 
							SysTray->show();	
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -285,49 +285,19 @@ void KeepassMainWindow::setupDatabaseConnections(IDatabase* DB){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
 | 
					void KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
 | 
				
			||||||
	Q_ASSERT(!FileOpen);
 | 
					 | 
				
			||||||
	if(!IsAuto){
 | 
						if(!IsAuto){
 | 
				
			||||||
		config.LastKeyLocation=QString();
 | 
							config.LastKeyLocation=QString();
 | 
				
			||||||
		config.LastKeyType=PASSWORD;}
 | 
							config.LastKeyType=PASSWORD;}
 | 
				
			||||||
	CPasswordDialog PasswordDlg(this,true,IsAuto);
 | 
						db=dynamic_cast<IDatabase*>(new StandardDatabase());
 | 
				
			||||||
 | 
						CPasswordDialog PasswordDlg(this,db,IsAuto,false);
 | 
				
			||||||
	PasswordDlg.setWindowTitle(filename);
 | 
						PasswordDlg.setWindowTitle(filename);
 | 
				
			||||||
	int r=PasswordDlg.exec();
 | 
						switch(PasswordDlg.exec()){
 | 
				
			||||||
	if(r==0) return;
 | 
							case 0: return;
 | 
				
			||||||
	if(r==2) {Start=false; return;}
 | 
							case 2: Start=false; return;
 | 
				
			||||||
	Q_ASSERT(r==1);
 | 
						}
 | 
				
			||||||
	db = new StandardDatabase();
 | 
					 | 
				
			||||||
	GroupView->db=db;
 | 
						GroupView->db=db;
 | 
				
			||||||
	EntryView->db=db;
 | 
						EntryView->db=db;
 | 
				
			||||||
	setupDatabaseConnections(db);	
 | 
						setupDatabaseConnections(db);	
 | 
				
			||||||
	IFilePasswordAuth* auth=dynamic_cast<IFilePasswordAuth*>(db);
 | 
					 | 
				
			||||||
	if(PasswordDlg.password!="" && PasswordDlg.keyfile=="")
 | 
					 | 
				
			||||||
		auth->authByPwd(PasswordDlg.password);
 | 
					 | 
				
			||||||
	if(PasswordDlg.password=="" && PasswordDlg.keyfile!=""){
 | 
					 | 
				
			||||||
		QFile keyfile(PasswordDlg.keyfile);
 | 
					 | 
				
			||||||
		if(!keyfile.open(QIODevice::ReadOnly)){
 | 
					 | 
				
			||||||
			delete db;
 | 
					 | 
				
			||||||
			QMessageBox::critical(this,tr("Error"),tr("Could not open key file."),tr("OK"));
 | 
					 | 
				
			||||||
			return;		
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if(!auth->authByFile(keyfile)){
 | 
					 | 
				
			||||||
			QMessageBox::critical(this,tr("Error"),db->getError(),tr("OK"));
 | 
					 | 
				
			||||||
			delete db;
 | 
					 | 
				
			||||||
			return;			
 | 
					 | 
				
			||||||
		}	
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if(PasswordDlg.password!="" && PasswordDlg.keyfile!=""){
 | 
					 | 
				
			||||||
		QFile keyfile(PasswordDlg.keyfile);
 | 
					 | 
				
			||||||
		if(!keyfile.open(QIODevice::ReadOnly)){
 | 
					 | 
				
			||||||
			delete db;
 | 
					 | 
				
			||||||
			QMessageBox::critical(this,tr("Error"),tr("Could not open key file."),tr("OK"));
 | 
					 | 
				
			||||||
			return;		
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if(!auth->authByFileAndPwd(PasswordDlg.password,keyfile)){
 | 
					 | 
				
			||||||
			QMessageBox::critical(this,tr("Error"),db->getError(),tr("OK"));
 | 
					 | 
				
			||||||
			delete db;
 | 
					 | 
				
			||||||
			return;			
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}		
 | 
					 | 
				
			||||||
	QString err;
 | 
						QString err;
 | 
				
			||||||
	StatusBarGeneral->setText(tr("Loading Database..."));
 | 
						StatusBarGeneral->setText(tr("Loading Database..."));
 | 
				
			||||||
	if(db->load(filename)==true){
 | 
						if(db->load(filename)==true){
 | 
				
			||||||
| 
						 | 
					@ -341,19 +311,20 @@ void KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
 | 
				
			||||||
	else{
 | 
						else{
 | 
				
			||||||
		StatusBarGeneral->setText(tr("Loading Failed"));
 | 
							StatusBarGeneral->setText(tr("Loading Failed"));
 | 
				
			||||||
		QString error=db->getError();
 | 
							QString error=db->getError();
 | 
				
			||||||
		bool KeyError=auth->isKeyError();
 | 
					 | 
				
			||||||
		delete db;
 | 
					 | 
				
			||||||
		if(error==QString())error=tr("Unknown error while loading database.");
 | 
							if(error==QString())error=tr("Unknown error while loading database.");
 | 
				
			||||||
		QMessageBox::critical(this,tr("Error")
 | 
							QMessageBox::critical(this,tr("Error")
 | 
				
			||||||
								,tr("The following error occured while opening the database:\n%1")
 | 
													,tr("The following error occured while opening the database:\n%1")
 | 
				
			||||||
								.arg(error),tr("OK"));
 | 
													.arg(error),tr("OK"));
 | 
				
			||||||
		if(KeyError)
 | 
							if(dynamic_cast<IFilePasswordAuth*>(db)->isKeyError()){
 | 
				
			||||||
 | 
								delete db;
 | 
				
			||||||
			openDatabase(filename,IsAuto);
 | 
								openDatabase(filename,IsAuto);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								delete db;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	StatusBarGeneral->setText(tr("Ready"));
 | 
						StatusBarGeneral->setText(tr("Ready"));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
bool KeepassMainWindow::closeDatabase(){
 | 
					bool KeepassMainWindow::closeDatabase(){
 | 
				
			||||||
	Q_ASSERT(FileOpen);
 | 
						Q_ASSERT(FileOpen);
 | 
				
			||||||
	Q_ASSERT(db!=NULL);
 | 
						Q_ASSERT(db!=NULL);
 | 
				
			||||||
| 
						 | 
					@ -381,52 +352,14 @@ bool KeepassMainWindow::closeDatabase(){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassMainWindow::OnFileNewKdb(){
 | 
					void KeepassMainWindow::OnFileNewKdb(){
 | 
				
			||||||
	CPasswordDialog dlg(this,true,false,true);
 | 
						IDatabase* db_new=dynamic_cast<IDatabase*>(new StandardDatabase());
 | 
				
			||||||
 | 
						db_new->create();
 | 
				
			||||||
 | 
						CPasswordDialog dlg(this,db_new,false,true);
 | 
				
			||||||
	dlg.setWindowTitle("New Database");
 | 
						dlg.setWindowTitle("New Database");
 | 
				
			||||||
	if(dlg.exec()==1){
 | 
						if(dlg.exec()==1){
 | 
				
			||||||
		if(FileOpen)
 | 
							if(FileOpen)
 | 
				
			||||||
			if(!closeDatabase())return;
 | 
								if(!closeDatabase())return;
 | 
				
			||||||
		db=new StandardDatabase();
 | 
							db=dynamic_cast<IDatabase*>(db_new);	
 | 
				
			||||||
		db->create();
 | 
					 | 
				
			||||||
		IFilePasswordAuth* DbAuth=dynamic_cast<IFilePasswordAuth*>(db);
 | 
					 | 
				
			||||||
		if(dlg.KeyType==BOTH || dlg.KeyType==KEYFILE){
 | 
					 | 
				
			||||||
			bool KeyFileExists=QFileInfo(dlg.keyfile).exists();
 | 
					 | 
				
			||||||
			if((KeyFileExists && dlg.OverwriteKeyFile) || !KeyFileExists){
 | 
					 | 
				
			||||||
				if(!DbAuth->createKeyFile(dlg.keyfile)){					
 | 
					 | 
				
			||||||
					QMessageBox::warning(this,tr("Error"),tr("Could not create key file. The following error occured:\n%1").arg(db->getError()),tr("OK"),"","",0,0);
 | 
					 | 
				
			||||||
					delete db; db=NULL;
 | 
					 | 
				
			||||||
					return;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}	
 | 
					 | 
				
			||||||
		if(dlg.password!="" && dlg.keyfile=="")
 | 
					 | 
				
			||||||
			DbAuth->authByPwd(dlg.password);
 | 
					 | 
				
			||||||
		if(dlg.password=="" && dlg.keyfile!=""){
 | 
					 | 
				
			||||||
			QFile keyfile(dlg.keyfile);
 | 
					 | 
				
			||||||
			if(!keyfile.open(QIODevice::ReadOnly)){
 | 
					 | 
				
			||||||
				delete db;
 | 
					 | 
				
			||||||
				QMessageBox::critical(this,tr("Error"),tr("Could not open key file."),tr("OK"));
 | 
					 | 
				
			||||||
				return;		
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if(!DbAuth->authByFile(keyfile)){
 | 
					 | 
				
			||||||
				QMessageBox::critical(this,tr("Error"),db->getError(),tr("OK"));
 | 
					 | 
				
			||||||
				delete db;
 | 
					 | 
				
			||||||
				return;			
 | 
					 | 
				
			||||||
			}	
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if(dlg.password!="" && dlg.keyfile!=""){
 | 
					 | 
				
			||||||
			QFile keyfile(dlg.keyfile);
 | 
					 | 
				
			||||||
			if(!keyfile.open(QIODevice::ReadOnly)){
 | 
					 | 
				
			||||||
				delete db;
 | 
					 | 
				
			||||||
				QMessageBox::critical(this,tr("Error"),tr("Could not open key file."),tr("OK"));
 | 
					 | 
				
			||||||
				return;		
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if(!DbAuth->authByFileAndPwd(dlg.password,keyfile)){
 | 
					 | 
				
			||||||
				QMessageBox::critical(this,tr("Error"),db->getError(),tr("OK"));
 | 
					 | 
				
			||||||
				delete db;
 | 
					 | 
				
			||||||
				return;			
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}		
 | 
					 | 
				
			||||||
		setWindowTitle(tr("%1 - KeePassX").arg(tr("[new]")));
 | 
							setWindowTitle(tr("%1 - KeePassX").arg(tr("[new]")));
 | 
				
			||||||
		GroupView->db=db;
 | 
							GroupView->db=db;
 | 
				
			||||||
		EntryView->db=db;		
 | 
							EntryView->db=db;		
 | 
				
			||||||
| 
						 | 
					@ -439,8 +372,12 @@ void KeepassMainWindow::OnFileNewKdb(){
 | 
				
			||||||
		setStateGroupSelected(NONE);
 | 
							setStateGroupSelected(NONE);
 | 
				
			||||||
		setStateEntrySelected(NONE);
 | 
							setStateEntrySelected(NONE);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						else{
 | 
				
			||||||
 | 
							delete db_new;		
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassMainWindow::OnFileNewKxdb(){
 | 
					void KeepassMainWindow::OnFileNewKxdb(){
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
| 
						 | 
					@ -694,27 +631,9 @@ if(dlg.exec())setStateFileModified(true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassMainWindow::OnFileChangeKey(){
 | 
					void KeepassMainWindow::OnFileChangeKey(){
 | 
				
			||||||
	/*
 | 
						CPasswordDialog dlg(this,db,false,true);
 | 
				
			||||||
CPasswordDialog dlg(this,true,false,true);
 | 
						if(dlg.exec())
 | 
				
			||||||
dlg.setWindowTitle(db->file->fileName());
 | 
					 | 
				
			||||||
if(dlg.exec()==1){
 | 
					 | 
				
			||||||
	if(dlg.KeyType==BOTH || dlg.KeyType==KEYFILE){
 | 
					 | 
				
			||||||
		if(!db->createKeyFile(dlg.keyfile)){
 | 
					 | 
				
			||||||
			QMessageBox::warning(this,tr("Error"),tr("Could not create key file. The following error occured:\n%1").arg(db->getError()),tr("OK"),"","",0,0);
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	IFilePasswordAuth* auth=dynamic_cast<IFilePasswordAuth*>db;
 | 
					 | 
				
			||||||
	if(dlg.password!="" && dlg.keyfile=="")
 | 
					 | 
				
			||||||
		auth->authByPwd(dlg.password);
 | 
					 | 
				
			||||||
	if(dlg.password=="" && dlg.keyfile!="")
 | 
					 | 
				
			||||||
		auth->authByFile(dlg.keyfile);
 | 
					 | 
				
			||||||
	if(dlg.password!="" && dlg.keyfile!="")
 | 
					 | 
				
			||||||
		auth->authByFileAndPw(dlg.keyfile,dlg.password);
 | 
					 | 
				
			||||||
		setStateFileModified(true);
 | 
							setStateFileModified(true);
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
	*/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassMainWindow::OnFileExit(){
 | 
					void KeepassMainWindow::OnFileExit(){
 | 
				
			||||||
| 
						 | 
					@ -866,18 +785,18 @@ void KeepassMainWindow::OnQuickSearch(){
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassMainWindow::OnColumnVisibilityChanged(bool value){
 | 
					void KeepassMainWindow::OnColumnVisibilityChanged(bool value){
 | 
				
			||||||
config.Columns[0]=ViewColumnsTitleAction->isChecked();
 | 
						config.Columns[0]=ViewColumnsTitleAction->isChecked();
 | 
				
			||||||
config.Columns[1]=ViewColumnsUsernameAction->isChecked();
 | 
						config.Columns[1]=ViewColumnsUsernameAction->isChecked();
 | 
				
			||||||
config.Columns[2]=ViewColumnsUrlAction->isChecked();
 | 
						config.Columns[2]=ViewColumnsUrlAction->isChecked();
 | 
				
			||||||
config.Columns[3]=ViewColumnsPasswordAction->isChecked();
 | 
						config.Columns[3]=ViewColumnsPasswordAction->isChecked();
 | 
				
			||||||
config.Columns[4]=ViewColumnsCommentAction->isChecked();
 | 
						config.Columns[4]=ViewColumnsCommentAction->isChecked();
 | 
				
			||||||
config.Columns[5]=ViewColumnsExpireAction->isChecked();
 | 
						config.Columns[5]=ViewColumnsExpireAction->isChecked();
 | 
				
			||||||
config.Columns[6]=ViewColumnsCreationAction->isChecked();
 | 
						config.Columns[6]=ViewColumnsCreationAction->isChecked();
 | 
				
			||||||
config.Columns[7]=ViewColumnsLastChangeAction->isChecked();
 | 
						config.Columns[7]=ViewColumnsLastChangeAction->isChecked();
 | 
				
			||||||
config.Columns[8]=ViewColumnsLastAccessAction->isChecked();
 | 
						config.Columns[8]=ViewColumnsLastAccessAction->isChecked();
 | 
				
			||||||
config.Columns[9]=ViewColumnsAttachmentAction->isChecked();
 | 
						config.Columns[9]=ViewColumnsAttachmentAction->isChecked();
 | 
				
			||||||
//EntryView->updateColumns();
 | 
						//EntryView->updateColumns();
 | 
				
			||||||
//if(FileOpen) EntryView->updateItems();
 | 
						//if(FileOpen) EntryView->updateItems();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassMainWindow::OnUsernPasswVisibilityChanged(bool value){
 | 
					void KeepassMainWindow::OnUsernPasswVisibilityChanged(bool value){
 | 
				
			||||||
| 
						 | 
					@ -891,7 +810,7 @@ setStateFileModified(true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassMainWindow::closeEvent(QCloseEvent* e){
 | 
					void KeepassMainWindow::closeEvent(QCloseEvent* e){
 | 
				
			||||||
	if(!ShutingDown){
 | 
						if(!ShutingDown && config.MinimizeToTray){
 | 
				
			||||||
		e->ignore();
 | 
							e->ignore();
 | 
				
			||||||
		hide();
 | 
							hide();
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					@ -918,10 +837,11 @@ void KeepassMainWindow::closeEvent(QCloseEvent* e){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassMainWindow::OnExtrasSettings(){
 | 
					void KeepassMainWindow::OnExtrasSettings(){
 | 
				
			||||||
CSettingsDlg dlg(this);
 | 
						CSettingsDlg dlg(this);
 | 
				
			||||||
dlg.exec();
 | 
						if(dlg.exec()==1){
 | 
				
			||||||
EntryView->setAlternatingRowColors(config.AlternatingRowColors);
 | 
							EntryView->setAlternatingRowColors(config.AlternatingRowColors);
 | 
				
			||||||
//Group::UI_ExpandByDefault=config.ExpandGroupTree;
 | 
							SysTray->setVisible(config.ShowSysTrayIcon);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassMainWindow::OnHelpAbout(){
 | 
					void KeepassMainWindow::OnHelpAbout(){
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,19 +46,17 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "ui_MainWindow.h"
 | 
					#include "ui_MainWindow.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
 | 
					class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
 | 
				
			||||||
Q_OBJECT
 | 
						Q_OBJECT
 | 
				
			||||||
public:
 | 
						public:
 | 
				
			||||||
		KeepassMainWindow (const QString& ArgFile,QWidget *parent=0, Qt::WFlags flags=0);
 | 
							KeepassMainWindow (const QString& ArgFile,QWidget *parent=0, Qt::WFlags flags=0);
 | 
				
			||||||
 StandardDatabase* db;
 | 
							IDatabase* db;
 | 
				
			||||||
	bool Start;
 | 
						bool Start;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
signals:
 | 
						signals:
 | 
				
			||||||
		void entryChanged();
 | 
							void entryChanged();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
private slots:
 | 
						private slots:
 | 
				
			||||||
		void OnFileNewKdb();
 | 
							void OnFileNewKdb();
 | 
				
			||||||
		void OnFileNewKxdb();
 | 
							void OnFileNewKxdb();
 | 
				
			||||||
		void OnFileOpen();
 | 
							void OnFileOpen();
 | 
				
			||||||
| 
						 | 
					@ -94,7 +92,8 @@ private slots:
 | 
				
			||||||
		void OnEntryChanged(SelectionState);
 | 
							void OnEntryChanged(SelectionState);
 | 
				
			||||||
		void OnSysTrayActivated(QSystemTrayIcon::ActivationReason);
 | 
							void OnSysTrayActivated(QSystemTrayIcon::ActivationReason);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
private:
 | 
						private:
 | 
				
			||||||
 | 
							void closeEvent(QCloseEvent* event);
 | 
				
			||||||
		SelectionState GroupSelection, EntrySelection;
 | 
							SelectionState GroupSelection, EntrySelection;
 | 
				
			||||||
		bool FileOpen;
 | 
							bool FileOpen;
 | 
				
			||||||
		bool ModFlag;
 | 
							bool ModFlag;
 | 
				
			||||||
| 
						 | 
					@ -107,7 +106,7 @@ private:
 | 
				
			||||||
		void setStateFileModified(bool);
 | 
							void setStateFileModified(bool);
 | 
				
			||||||
		void setStateGroupSelected(SelectionState s);
 | 
							void setStateGroupSelected(SelectionState s);
 | 
				
			||||||
		void setStateEntrySelected(SelectionState s);
 | 
							void setStateEntrySelected(SelectionState s);
 | 
				
			||||||
 void openDatabase(QString filename,bool IsStart=false);
 | 
							void openDatabase(QString filename,bool IsAuto=false);
 | 
				
			||||||
		void setupDatabaseConnections(IDatabase* DB);
 | 
							void setupDatabaseConnections(IDatabase* DB);
 | 
				
			||||||
		bool closeDatabase();
 | 
							bool closeDatabase();
 | 
				
			||||||
		void search(IGroupHandle* Group);
 | 
							void search(IGroupHandle* Group);
 | 
				
			||||||
| 
						 | 
					@ -121,13 +120,6 @@ private:
 | 
				
			||||||
		QAction* ViewShowToolbarAction;
 | 
							QAction* ViewShowToolbarAction;
 | 
				
			||||||
		QMenu* SysTrayMenu;
 | 
							QMenu* SysTrayMenu;
 | 
				
			||||||
		bool ShutingDown;
 | 
							bool ShutingDown;
 | 
				
			||||||
protected:
 | 
					 | 
				
			||||||
 void closeEvent(QCloseEvent* event);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,6 +39,7 @@ QString GnomePlugin::openExistingFileDialog(QWidget* parent,QString title,QStrin
 | 
				
			||||||
				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 | 
									GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 | 
				
			||||||
				GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
 | 
									GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
 | 
				
			||||||
				NULL);
 | 
									NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(FileDlg),CSTR(dir));
 | 
						gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(FileDlg),CSTR(dir));
 | 
				
			||||||
	GtkFileFilter** filters=parseFilterStrings(Filters);
 | 
						GtkFileFilter** filters=parseFilterStrings(Filters);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue