fixed problem with config saving,
main-window size an splitter position are restored on start-up, loading icons on demand by QIcon class instead of preload, column resizing stuff (not finished) git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@50 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
		
							parent
							
								
									f89372b0c5
								
							
						
					
					
						commit
						d6ea6e8971
					
				
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 2.7 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 2.9 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 2.6 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 2.2 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 2.8 KiB  | 
| 
						 | 
					@ -25,7 +25,7 @@
 | 
				
			||||||
using namespace std;
 | 
					using namespace std;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool CConfig::loadFromIni(QString filename){
 | 
					bool CConfig::loadFromIni(QString filename){
 | 
				
			||||||
CIniFile ini((char*)filename.data());
 | 
					ini.SetPath((const char*)filename);
 | 
				
			||||||
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);
 | 
				
			||||||
| 
						 | 
					@ -47,12 +47,15 @@ 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);
 | 
				
			||||||
EnableKdePlugin=ini.GetValueB("KDE Plugin","Enabled",false);
 | 
					EnableKdePlugin=ini.GetValueB("KDE Plugin","Enabled",false);
 | 
				
			||||||
 | 
					MainWinHeight=ini.GetValueI("UI","MainWinHeight",550);
 | 
				
			||||||
 | 
					MainWinWidth=ini.GetValueI("UI","MainWinWidth",900);
 | 
				
			||||||
 | 
					MainWinSplit1=ini.GetValueI("UI","MainWinSplit1",100);
 | 
				
			||||||
 | 
					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);
 | 
				
			||||||
return true;
 | 
					return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool CConfig::saveToIni(QString filename){
 | 
					bool CConfig::saveToIni(QString filename){
 | 
				
			||||||
CIniFile ini((const char*)filename);
 | 
					 | 
				
			||||||
ini.ReadFile();
 | 
					 | 
				
			||||||
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);
 | 
				
			||||||
| 
						 | 
					@ -73,6 +76,11 @@ ini.SetValueI("Options","PwGenLength",PwGenLength,true);
 | 
				
			||||||
ini.SetValue("Options","PwGenCharList",(const char*)PwGenCharList,true);
 | 
					ini.SetValue("Options","PwGenCharList",(const char*)PwGenCharList,true);
 | 
				
			||||||
ini.SetValueB("Options","ExpandGroupTree",ExpandGroupTree,true);
 | 
					ini.SetValueB("Options","ExpandGroupTree",ExpandGroupTree,true);
 | 
				
			||||||
ini.SetValueB("KDE Plugin","Enabled",EnableKdePlugin,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);
 | 
				
			||||||
if(!ini.WriteFile())return false;
 | 
					if(!ini.WriteFile())return false;
 | 
				
			||||||
else return true;
 | 
					else return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -136,3 +144,34 @@ else	  str+="0";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
return str;
 | 
					return str;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define DEFAULT_INT_VAL 20
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void CConfig::ParseIntString(const QString &str,int* dst, int count){
 | 
				
			||||||
 | 
					QStringList lst=str.split(",");
 | 
				
			||||||
 | 
					if(lst.size()!=count)
 | 
				
			||||||
 | 
						qWarning("Warnig: CConfig::ParseIntString(): unexpected item count.\n");
 | 
				
			||||||
 | 
					int* values=new int[count];
 | 
				
			||||||
 | 
					bool err;
 | 
				
			||||||
 | 
					for(int i=0;i<lst.size() && i<count;i++){
 | 
				
			||||||
 | 
						values[i]=lst[i].toUInt(&err);
 | 
				
			||||||
 | 
						if(!err){
 | 
				
			||||||
 | 
							qWarning("Warnig: CConfig::ParseIntString(): invalid int value.\n");
 | 
				
			||||||
 | 
							values[i]=DEFAULT_INT_VAL;}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					if(count > lst.size()){
 | 
				
			||||||
 | 
						for(int i=lst.size(); i<count; i++)
 | 
				
			||||||
 | 
							values[i]=DEFAULT_INT_VAL;}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					memcpy(dst,values,count);
 | 
				
			||||||
 | 
					delete [] values;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QString CConfig::CreateIntString(int* src, int count){
 | 
				
			||||||
 | 
					QString str;
 | 
				
			||||||
 | 
					for(int i=0;i<count;i++){
 | 
				
			||||||
 | 
						str+=QString::number(src[i]);
 | 
				
			||||||
 | 
						if(i<(count-1))str+=",";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					return str;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -46,17 +46,25 @@ public:
 | 
				
			||||||
 QString PwGenCharList;
 | 
					 QString PwGenCharList;
 | 
				
			||||||
 bool ExpandGroupTree;
 | 
					 bool ExpandGroupTree;
 | 
				
			||||||
 bool EnableKdePlugin;
 | 
					 bool EnableKdePlugin;
 | 
				
			||||||
 | 
					 int MainWinHeight;
 | 
				
			||||||
 | 
					 int MainWinWidth;
 | 
				
			||||||
 | 
					 int MainWinSplit1;
 | 
				
			||||||
 | 
					 int MainWinSplit2;
 | 
				
			||||||
 | 
					 int ColumnSizes[10];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 bool loadFromIni(QString filename);
 | 
					 bool loadFromIni(QString filename);
 | 
				
			||||||
 bool saveToIni(QString filename);
 | 
					 bool saveToIni(QString filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 | 
					 CIniFile ini;
 | 
				
			||||||
 void ParseColumnString(QString str, bool* dst);
 | 
					 void ParseColumnString(QString str, bool* dst);
 | 
				
			||||||
 void ParseBoolString(const QString &str,bool* dst, int count);
 | 
					 void ParseBoolString(const QString &str,bool* dst, int count);
 | 
				
			||||||
 | 
					 void ParseIntString(const QString &str,int* dst, int count);
 | 
				
			||||||
 QString CreateBoolString(bool* src, int count);
 | 
					 QString CreateBoolString(bool* src, int count);
 | 
				
			||||||
 QColor ParseColorString(QString str);
 | 
					 QColor ParseColorString(QString str);
 | 
				
			||||||
 QString CreateColumnString();
 | 
					 QString CreateColumnString();
 | 
				
			||||||
 QString CreateColorString(QColor);
 | 
					 QString CreateColorString(QColor);
 | 
				
			||||||
 | 
					 QString CreateIntString(int* src, int count);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					@ -90,11 +90,17 @@
 | 
				
			||||||
      <property name="sizePolicy" >
 | 
					      <property name="sizePolicy" >
 | 
				
			||||||
       <sizepolicy>
 | 
					       <sizepolicy>
 | 
				
			||||||
        <hsizetype>7</hsizetype>
 | 
					        <hsizetype>7</hsizetype>
 | 
				
			||||||
        <vsizetype>7</vsizetype>
 | 
					        <vsizetype>4</vsizetype>
 | 
				
			||||||
        <horstretch>0</horstretch>
 | 
					        <horstretch>0</horstretch>
 | 
				
			||||||
        <verstretch>10</verstretch>
 | 
					        <verstretch>10</verstretch>
 | 
				
			||||||
       </sizepolicy>
 | 
					       </sizepolicy>
 | 
				
			||||||
      </property>
 | 
					      </property>
 | 
				
			||||||
 | 
					      <property name="maximumSize" >
 | 
				
			||||||
 | 
					       <size>
 | 
				
			||||||
 | 
					        <width>16777215</width>
 | 
				
			||||||
 | 
					        <height>60</height>
 | 
				
			||||||
 | 
					       </size>
 | 
				
			||||||
 | 
					      </property>
 | 
				
			||||||
     </widget>
 | 
					     </widget>
 | 
				
			||||||
    </item>
 | 
					    </item>
 | 
				
			||||||
   </layout>
 | 
					   </layout>
 | 
				
			||||||
| 
						 | 
					@ -105,7 +111,7 @@
 | 
				
			||||||
     <x>0</x>
 | 
					     <x>0</x>
 | 
				
			||||||
     <y>0</y>
 | 
					     <y>0</y>
 | 
				
			||||||
     <width>724</width>
 | 
					     <width>724</width>
 | 
				
			||||||
     <height>30</height>
 | 
					     <height>29</height>
 | 
				
			||||||
    </rect>
 | 
					    </rect>
 | 
				
			||||||
   </property>
 | 
					   </property>
 | 
				
			||||||
   <widget class="QMenu" name="menuHilfe" >
 | 
					   <widget class="QMenu" name="menuHilfe" >
 | 
				
			||||||
| 
						 | 
					@ -469,16 +475,16 @@
 | 
				
			||||||
 <pixmapfunction></pixmapfunction>
 | 
					 <pixmapfunction></pixmapfunction>
 | 
				
			||||||
 <customwidgets>
 | 
					 <customwidgets>
 | 
				
			||||||
  <customwidget>
 | 
					  <customwidget>
 | 
				
			||||||
   <class>KeepassEntryView</class>
 | 
					   <class>KeepassGroupView</class>
 | 
				
			||||||
   <extends>QTreeWidget</extends>
 | 
					   <extends>QTreeWidget</extends>
 | 
				
			||||||
   <header>../../src/lib/EntryView.h</header>
 | 
					   <header>../../src/lib/GroupView.h</header>
 | 
				
			||||||
   <container>0</container>
 | 
					   <container>0</container>
 | 
				
			||||||
   <pixmap></pixmap>
 | 
					   <pixmap></pixmap>
 | 
				
			||||||
  </customwidget>
 | 
					  </customwidget>
 | 
				
			||||||
  <customwidget>
 | 
					  <customwidget>
 | 
				
			||||||
   <class>KeepassGroupView</class>
 | 
					   <class>KeepassEntryView</class>
 | 
				
			||||||
   <extends>QTreeWidget</extends>
 | 
					   <extends>QTreeWidget</extends>
 | 
				
			||||||
   <header>../../src/lib/GroupView.h</header>
 | 
					   <header>../../src/lib/EntryView.h</header>
 | 
				
			||||||
   <container>0</container>
 | 
					   <container>0</container>
 | 
				
			||||||
   <pixmap></pixmap>
 | 
					   <pixmap></pixmap>
 | 
				
			||||||
  </customwidget>
 | 
					  </customwidget>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,38 +27,6 @@
 | 
				
			||||||
  <property name="windowTitle" >
 | 
					  <property name="windowTitle" >
 | 
				
			||||||
   <string>Einstellungen</string>
 | 
					   <string>Einstellungen</string>
 | 
				
			||||||
  </property>
 | 
					  </property>
 | 
				
			||||||
  <widget class="QPushButton" name="ButtonCancel" >
 | 
					 | 
				
			||||||
   <property name="geometry" >
 | 
					 | 
				
			||||||
    <rect>
 | 
					 | 
				
			||||||
     <x>470</x>
 | 
					 | 
				
			||||||
     <y>310</y>
 | 
					 | 
				
			||||||
     <width>90</width>
 | 
					 | 
				
			||||||
     <height>23</height>
 | 
					 | 
				
			||||||
    </rect>
 | 
					 | 
				
			||||||
   </property>
 | 
					 | 
				
			||||||
   <property name="text" >
 | 
					 | 
				
			||||||
    <string>Abbre&chen</string>
 | 
					 | 
				
			||||||
   </property>
 | 
					 | 
				
			||||||
   <property name="shortcut" >
 | 
					 | 
				
			||||||
    <string>Alt+C</string>
 | 
					 | 
				
			||||||
   </property>
 | 
					 | 
				
			||||||
  </widget>
 | 
					 | 
				
			||||||
  <widget class="QPushButton" name="ButtonOK" >
 | 
					 | 
				
			||||||
   <property name="geometry" >
 | 
					 | 
				
			||||||
    <rect>
 | 
					 | 
				
			||||||
     <x>380</x>
 | 
					 | 
				
			||||||
     <y>310</y>
 | 
					 | 
				
			||||||
     <width>80</width>
 | 
					 | 
				
			||||||
     <height>23</height>
 | 
					 | 
				
			||||||
    </rect>
 | 
					 | 
				
			||||||
   </property>
 | 
					 | 
				
			||||||
   <property name="text" >
 | 
					 | 
				
			||||||
    <string>O&K</string>
 | 
					 | 
				
			||||||
   </property>
 | 
					 | 
				
			||||||
   <property name="shortcut" >
 | 
					 | 
				
			||||||
    <string>Alt+K</string>
 | 
					 | 
				
			||||||
   </property>
 | 
					 | 
				
			||||||
  </widget>
 | 
					 | 
				
			||||||
  <widget class="QLabel" name="Banner" >
 | 
					  <widget class="QLabel" name="Banner" >
 | 
				
			||||||
   <property name="geometry" >
 | 
					   <property name="geometry" >
 | 
				
			||||||
    <rect>
 | 
					    <rect>
 | 
				
			||||||
| 
						 | 
					@ -79,9 +47,9 @@
 | 
				
			||||||
   <property name="geometry" >
 | 
					   <property name="geometry" >
 | 
				
			||||||
    <rect>
 | 
					    <rect>
 | 
				
			||||||
     <x>10</x>
 | 
					     <x>10</x>
 | 
				
			||||||
     <y>59</y>
 | 
					     <y>60</y>
 | 
				
			||||||
     <width>550</width>
 | 
					     <width>550</width>
 | 
				
			||||||
     <height>251</height>
 | 
					     <height>241</height>
 | 
				
			||||||
    </rect>
 | 
					    </rect>
 | 
				
			||||||
   </property>
 | 
					   </property>
 | 
				
			||||||
   <widget class="QWidget" name="tab" >
 | 
					   <widget class="QWidget" name="tab" >
 | 
				
			||||||
| 
						 | 
					@ -355,6 +323,38 @@
 | 
				
			||||||
    </widget>
 | 
					    </widget>
 | 
				
			||||||
   </widget>
 | 
					   </widget>
 | 
				
			||||||
  </widget>
 | 
					  </widget>
 | 
				
			||||||
 | 
					  <widget class="QPushButton" name="ButtonOK" >
 | 
				
			||||||
 | 
					   <property name="geometry" >
 | 
				
			||||||
 | 
					    <rect>
 | 
				
			||||||
 | 
					     <x>380</x>
 | 
				
			||||||
 | 
					     <y>310</y>
 | 
				
			||||||
 | 
					     <width>80</width>
 | 
				
			||||||
 | 
					     <height>23</height>
 | 
				
			||||||
 | 
					    </rect>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					   <property name="text" >
 | 
				
			||||||
 | 
					    <string>O&K</string>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					   <property name="shortcut" >
 | 
				
			||||||
 | 
					    <string>Alt+K</string>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					  </widget>
 | 
				
			||||||
 | 
					  <widget class="QPushButton" name="ButtonCancel" >
 | 
				
			||||||
 | 
					   <property name="geometry" >
 | 
				
			||||||
 | 
					    <rect>
 | 
				
			||||||
 | 
					     <x>470</x>
 | 
				
			||||||
 | 
					     <y>310</y>
 | 
				
			||||||
 | 
					     <width>90</width>
 | 
				
			||||||
 | 
					     <height>23</height>
 | 
				
			||||||
 | 
					    </rect>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					   <property name="text" >
 | 
				
			||||||
 | 
					    <string>Abbre&chen</string>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					   <property name="shortcut" >
 | 
				
			||||||
 | 
					    <string>Alt+C</string>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					  </widget>
 | 
				
			||||||
 </widget>
 | 
					 </widget>
 | 
				
			||||||
 <layoutdefault spacing="6" margin="11" />
 | 
					 <layoutdefault spacing="6" margin="11" />
 | 
				
			||||||
 <pixmapfunction></pixmapfunction>
 | 
					 <pixmapfunction></pixmapfunction>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
/***************************************************************************
 | 
					/***************************************************************************
 | 
				
			||||||
 *   Copyright (C) 2005 by Tarek Saidi                                     *
 | 
					 *   Copyright (C) 2005-2006 by Tarek Saidi                                 *
 | 
				
			||||||
 *   tarek.saidi@arcor.de                                                  *
 | 
					 *   tarek.saidi@arcor.de                                                  *
 | 
				
			||||||
 *                                                                         *
 | 
					 *                                                                         *
 | 
				
			||||||
 *   This program is free software; you can redistribute it and/or modify  *
 | 
					 *   This program is free software; you can redistribute it and/or modify  *
 | 
				
			||||||
| 
						 | 
					@ -34,8 +34,10 @@
 | 
				
			||||||
KeepassEntryView::KeepassEntryView(QWidget* parent):QTreeWidget(parent){
 | 
					KeepassEntryView::KeepassEntryView(QWidget* parent):QTreeWidget(parent){
 | 
				
			||||||
CurrentGroup=0;
 | 
					CurrentGroup=0;
 | 
				
			||||||
updateColumns();
 | 
					updateColumns();
 | 
				
			||||||
header()->setResizeMode(QHeaderView::Stretch);
 | 
					header()->setResizeMode(QHeaderView::Interactive);
 | 
				
			||||||
 | 
					header()->setStretchLastSection(false);
 | 
				
			||||||
ContextMenu=new QMenu(this);
 | 
					ContextMenu=new QMenu(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,6 +68,10 @@ e->accept();
 | 
				
			||||||
ContextMenu->popup(e->globalPos());
 | 
					ContextMenu->popup(e->globalPos());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void KeepassEntryView::resizeEvent(QResizeEvent* e){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					e->accept();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassEntryView::updateItems(unsigned int GroupID){
 | 
					void KeepassEntryView::updateItems(unsigned int GroupID){
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,9 +40,11 @@ public:
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 void setEntry(CEntry* entry);
 | 
					 void setEntry(CEntry* entry);
 | 
				
			||||||
 int CurrentGroup;
 | 
					 int CurrentGroup;
 | 
				
			||||||
 | 
					 QList<float>ColumnSizes;
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
 virtual void contextMenuEvent(QContextMenuEvent *event);
 | 
					 virtual void contextMenuEvent(QContextMenuEvent *event);
 | 
				
			||||||
 virtual void paintEvent ( QPaintEvent * event );
 | 
					 virtual void paintEvent(QPaintEvent* event);
 | 
				
			||||||
 | 
					 virtual void resizeEvent(QResizeEvent* event);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,19 @@
 | 
				
			||||||
 | 
					/***************************************************************************
 | 
				
			||||||
 | 
					 *   Copyright (C) 2005-2006 by Tarek Saidi                                *
 | 
				
			||||||
 | 
					 *   tarek.saidi@arcor.de                                                  *
 | 
				
			||||||
 | 
					 *                                                                         *
 | 
				
			||||||
 | 
					 *   This program is free software; you can redistribute it and/or modify  *
 | 
				
			||||||
 | 
					 *   it under the terms of the GNU General Public License as published by  *
 | 
				
			||||||
 | 
					 *   the Free Software Foundation; either version 2 of the License, or     *
 | 
				
			||||||
 | 
					 *   (at your option) any later version.                                   *
 | 
				
			||||||
 | 
					 *                                                                         *
 | 
				
			||||||
 | 
					 *   This program is distributed in the hope that it will be useful,       *
 | 
				
			||||||
 | 
					 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 | 
				
			||||||
 | 
					 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 | 
				
			||||||
 | 
					 *   GNU General Public License for more details.                          *
 | 
				
			||||||
 | 
					 *                                                                         *
 | 
				
			||||||
 | 
					 *   You should have received a copy of the GNU General Public License     *
 | 
				
			||||||
 | 
					 *   along with this program; if not, write to the                         *
 | 
				
			||||||
 | 
					 *   Free Software Foundation, Inc.,                                       *
 | 
				
			||||||
 | 
					 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 | 
				
			||||||
 | 
					 ***************************************************************************/
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,28 @@
 | 
				
			||||||
 | 
					/***************************************************************************
 | 
				
			||||||
 | 
					 *   Copyright (C) 2005-2006 by Tarek Saidi                                *
 | 
				
			||||||
 | 
					 *   tarek.saidi@arcor.de                                                  *
 | 
				
			||||||
 | 
					 *                                                                         *
 | 
				
			||||||
 | 
					 *   This program is free software; you can redistribute it and/or modify  *
 | 
				
			||||||
 | 
					 *   it under the terms of the GNU General Public License as published by  *
 | 
				
			||||||
 | 
					 *   the Free Software Foundation; either version 2 of the License, or     *
 | 
				
			||||||
 | 
					 *   (at your option) any later version.                                   *
 | 
				
			||||||
 | 
					 *                                                                         *
 | 
				
			||||||
 | 
					 *   This program is distributed in the hope that it will be useful,       *
 | 
				
			||||||
 | 
					 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 | 
				
			||||||
 | 
					 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 | 
				
			||||||
 | 
					 *   GNU General Public License for more details.                          *
 | 
				
			||||||
 | 
					 *                                                                         *
 | 
				
			||||||
 | 
					 *   You should have received a copy of the GNU General Public License     *
 | 
				
			||||||
 | 
					 *   along with this program; if not, write to the                         *
 | 
				
			||||||
 | 
					 *   Free Software Foundation, Inc.,                                       *
 | 
				
			||||||
 | 
					 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 | 
				
			||||||
 | 
					 ***************************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QFileIconProvider>
 | 
				
			||||||
 | 
					#include <QIcon>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class KpFileIconProvider : public QFileIconProvider{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					 virtual QIcon icon(IconType type) const;
 | 
				
			||||||
 | 
					 virtual QIcon icon(const QFileInfo& info) const;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
							
								
								
									
										70
									
								
								src/main.cpp
								
								
								
								
							
							
						
						
									
										70
									
								
								src/main.cpp
								
								
								
								
							| 
						 | 
					@ -88,6 +88,7 @@ else{
 | 
				
			||||||
 config.loadFromIni(IniFilename);}
 | 
					 config.loadFromIni(IniFilename);}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Internationalization
 | 
					//Internationalization
 | 
				
			||||||
QLocale loc=QLocale::system();
 | 
					QLocale loc=QLocale::system();
 | 
				
			||||||
QTranslator* translator = 0;
 | 
					QTranslator* translator = 0;
 | 
				
			||||||
| 
						 | 
					@ -207,15 +208,21 @@ if(Img.load(AppDir+"/../share/keepass/icons/"+name)==false){
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define _loadIcon(_VAR,_NAME)\
 | 
				
			||||||
 | 
						_VAR=new QIcon(ThemeDir+_NAME);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void loadImages(){
 | 
					void loadImages(){
 | 
				
			||||||
QString ThemeDir="nuvola/32x32";
 | 
					bool small=true;
 | 
				
			||||||
 | 
					QString ThemeDir=AppDir+"/../share/keepass/icons/nuvola/32x32";
 | 
				
			||||||
QPixmap tmpImg;
 | 
					QPixmap tmpImg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//-----------------------
 | 
					//-----------------------
 | 
				
			||||||
loadImg("clientic.png",tmpImg);
 | 
					loadImg("clientic.png",tmpImg);
 | 
				
			||||||
EntryIcons=new QPixmap[NUM_CLIENT_ICONS];
 | 
					EntryIcons=new QPixmap[NUM_CLIENT_ICONS];
 | 
				
			||||||
for(int i=0;i<NUM_CLIENT_ICONS;i++){
 | 
					for(int i=0;i<NUM_CLIENT_ICONS;i++){
 | 
				
			||||||
EntryIcons[i]=tmpImg.copy(i*16,0,16,16);}
 | 
					EntryIcons[i]=tmpImg.copy(i*16,0,16,16);}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//--------------------------
 | 
					//--------------------------
 | 
				
			||||||
loadImg("key.png",tmpImg);
 | 
					loadImg("key.png",tmpImg);
 | 
				
			||||||
Icon_Key32x32=new QPixmap;
 | 
					Icon_Key32x32=new QPixmap;
 | 
				
			||||||
| 
						 | 
					@ -237,50 +244,23 @@ loadImg("search.png",tmpImg);
 | 
				
			||||||
Icon_Search32x32=new QPixmap;
 | 
					Icon_Search32x32=new QPixmap;
 | 
				
			||||||
*Icon_Search32x32=tmpImg;
 | 
					*Icon_Search32x32=tmpImg;
 | 
				
			||||||
//--------------------------
 | 
					//--------------------------
 | 
				
			||||||
loadImg(ThemeDir+"/actions/filenew.png",tmpImg);
 | 
					
 | 
				
			||||||
Icon_FileNew=new QIcon(tmpImg);
 | 
					
 | 
				
			||||||
//--------------------------
 | 
					_loadIcon(Icon_FileNew,"/actions/filenew.png");
 | 
				
			||||||
loadImg(ThemeDir+"/actions/fileopen.png",tmpImg);
 | 
					_loadIcon(Icon_FileOpen,"/actions/fileopen.png");
 | 
				
			||||||
Icon_FileOpen=new QIcon(tmpImg);
 | 
					_loadIcon(Icon_FileSave,"/actions/filesave.png");
 | 
				
			||||||
//--------------------------
 | 
					_loadIcon(Icon_FileSaveAs,"/actions/filesaveas.png");
 | 
				
			||||||
loadImg(ThemeDir+"/actions/filesave.png",tmpImg);
 | 
					_loadIcon(Icon_FileClose,"/actions/fileclose.png");
 | 
				
			||||||
Icon_FileSave=new QIcon(tmpImg);
 | 
					_loadIcon(Icon_Exit,"/actions/exit.png");
 | 
				
			||||||
//--------------------------
 | 
					_loadIcon(Icon_EditDelete,"/actions/editdelete.png");
 | 
				
			||||||
loadImg(ThemeDir+"/actions/filesaveas.png",tmpImg);
 | 
					_loadIcon(Icon_EditAdd,"/actions/edit_add.png");
 | 
				
			||||||
Icon_FileSaveAs=new QIcon(tmpImg);
 | 
					_loadIcon(Icon_EditEdit,"/actions/edit.png");
 | 
				
			||||||
//--------------------------
 | 
					_loadIcon(Icon_EditUsernameToCb,"/actions/identity.png");
 | 
				
			||||||
loadImg(ThemeDir+"/actions/fileclose.png",tmpImg);
 | 
					_loadIcon(Icon_EditPasswordToCb,"/actions/klipper_dock.png");
 | 
				
			||||||
Icon_FileClose=new QIcon(tmpImg);
 | 
					_loadIcon(Icon_EditClone,"/actions/editcopy.png");
 | 
				
			||||||
//--------------------------
 | 
					_loadIcon(Icon_EditOpenUrl,"/actions/run.png");
 | 
				
			||||||
loadImg(ThemeDir+"/actions/exit.png",tmpImg);
 | 
					_loadIcon(Icon_EditSearch,"/actions/find.png");
 | 
				
			||||||
Icon_Exit=new QIcon(tmpImg);
 | 
					_loadIcon(Icon_Configure,"/actions/configure.png");
 | 
				
			||||||
//--------------------------
 | 
					 | 
				
			||||||
loadImg(ThemeDir+"/actions/editdelete.png",tmpImg);
 | 
					 | 
				
			||||||
Icon_EditDelete=new QIcon(tmpImg);
 | 
					 | 
				
			||||||
//--------------------------
 | 
					 | 
				
			||||||
loadImg(ThemeDir+"/actions/edit_add.png",tmpImg);
 | 
					 | 
				
			||||||
Icon_EditAdd=new QIcon(tmpImg);
 | 
					 | 
				
			||||||
//--------------------------
 | 
					 | 
				
			||||||
loadImg(ThemeDir+"/actions/edit.png",tmpImg);
 | 
					 | 
				
			||||||
Icon_EditEdit=new QIcon(tmpImg);
 | 
					 | 
				
			||||||
//--------------------------
 | 
					 | 
				
			||||||
loadImg(ThemeDir+"/actions/identity.png",tmpImg);
 | 
					 | 
				
			||||||
Icon_EditUsernameToCb=new QIcon(tmpImg);
 | 
					 | 
				
			||||||
//--------------------------
 | 
					 | 
				
			||||||
loadImg(ThemeDir+"/actions/klipper_dock.png",tmpImg);
 | 
					 | 
				
			||||||
Icon_EditPasswordToCb=new QIcon(tmpImg);
 | 
					 | 
				
			||||||
//--------------------------
 | 
					 | 
				
			||||||
loadImg(ThemeDir+"/actions/editcopy.png",tmpImg);
 | 
					 | 
				
			||||||
Icon_EditClone=new QIcon(tmpImg);
 | 
					 | 
				
			||||||
//--------------------------
 | 
					 | 
				
			||||||
loadImg(ThemeDir+"/actions/run.png",tmpImg);
 | 
					 | 
				
			||||||
Icon_EditOpenUrl=new QIcon(tmpImg);
 | 
					 | 
				
			||||||
//--------------------------
 | 
					 | 
				
			||||||
loadImg(ThemeDir+"/actions/find.png",tmpImg);
 | 
					 | 
				
			||||||
Icon_EditSearch=new QIcon(tmpImg);
 | 
					 | 
				
			||||||
//--------------------------
 | 
					 | 
				
			||||||
loadImg(ThemeDir+"/actions/configure.png",tmpImg);
 | 
					 | 
				
			||||||
Icon_Configure=new QIcon(tmpImg);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,7 +60,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
KeepassMainWindow::KeepassMainWindow(QWidget *parent, Qt::WFlags flags):QMainWindow(parent,flags){
 | 
					KeepassMainWindow::KeepassMainWindow(QWidget *parent, Qt::WFlags flags):QMainWindow(parent,flags){
 | 
				
			||||||
  setupUi(this);
 | 
					  setupUi(this);
 | 
				
			||||||
 | 
					  setGeometry(geometry().x(),geometry().y(),config.MainWinWidth,config.MainWinHeight);
 | 
				
			||||||
 | 
					  splitter->setSizes(QList<int>() << config.MainWinSplit1 << config.MainWinSplit2);
 | 
				
			||||||
  QuickSearchEdit=new QLineEdit(toolBar);
 | 
					  QuickSearchEdit=new QLineEdit(toolBar);
 | 
				
			||||||
  QuickSearchEdit->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
 | 
					  QuickSearchEdit->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
 | 
				
			||||||
  setupIcons();
 | 
					  setupIcons();
 | 
				
			||||||
| 
						 | 
					@ -530,8 +531,6 @@ if(dlg.exec()) setStateFileModified(true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassMainWindow::OnFileExit(){
 | 
					void KeepassMainWindow::OnFileExit(){
 | 
				
			||||||
if(FileOpen)
 | 
					 | 
				
			||||||
 if(!closeDatabase())return;
 | 
					 | 
				
			||||||
close();
 | 
					close();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -765,6 +764,11 @@ setStateFileModified(true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void KeepassMainWindow::closeEvent(QCloseEvent* e){
 | 
					void KeepassMainWindow::closeEvent(QCloseEvent* e){
 | 
				
			||||||
 | 
					config.MainWinHeight=geometry().height();
 | 
				
			||||||
 | 
					config.MainWinWidth=geometry().width();
 | 
				
			||||||
 | 
					config.MainWinSplit1=splitter->sizes()[0];
 | 
				
			||||||
 | 
					config.MainWinSplit2=splitter->sizes()[1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if(FileOpen){
 | 
					if(FileOpen){
 | 
				
			||||||
 if(!closeDatabase())
 | 
					 if(!closeDatabase())
 | 
				
			||||||
 	e->ignore();
 | 
					 	e->ignore();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,7 +51,8 @@ HEADERS += lib/IniReader.h \
 | 
				
			||||||
           main.h \
 | 
					           main.h \
 | 
				
			||||||
           lib/GroupView.h \
 | 
					           lib/GroupView.h \
 | 
				
			||||||
           lib/EntryView.h \
 | 
					           lib/EntryView.h \
 | 
				
			||||||
           crypto/arcfour.h 
 | 
					           crypto/arcfour.h \
 | 
				
			||||||
 | 
					           lib/KpFileIconProvider.h 
 | 
				
			||||||
SOURCES += lib/IniReader.cpp \
 | 
					SOURCES += lib/IniReader.cpp \
 | 
				
			||||||
           lib/UrlLabel.cpp \
 | 
					           lib/UrlLabel.cpp \
 | 
				
			||||||
           main.cpp \
 | 
					           main.cpp \
 | 
				
			||||||
| 
						 | 
					@ -83,7 +84,8 @@ SOURCES += lib/IniReader.cpp \
 | 
				
			||||||
           lib/KdePlugin.cpp \
 | 
					           lib/KdePlugin.cpp \
 | 
				
			||||||
           lib/GroupView.cpp \
 | 
					           lib/GroupView.cpp \
 | 
				
			||||||
           lib/EntryView.cpp \
 | 
					           lib/EntryView.cpp \
 | 
				
			||||||
           crypto/arcfour.cpp 
 | 
					           crypto/arcfour.cpp \
 | 
				
			||||||
 | 
					           lib/KpFileIconProvider.cpp 
 | 
				
			||||||
QT += xml \
 | 
					QT += xml \
 | 
				
			||||||
qt3support
 | 
					qt3support
 | 
				
			||||||
MOC_DIR = ../build/moc
 | 
					MOC_DIR = ../build/moc
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue