removed some unused files,

made file dialog wrapper use native dialogs again,
fixed password dialog not remembering last key location/type,
disabled precompiled headers when buidling universal binaries,
updated changelog,
fixed size problems of some dialogs


git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@179 b624d157-de02-0410-bad0-e51aec6abb33
master
tarek_saidi 17 years ago
parent ed3baff013
commit 8446ef1f75
  1. 9
      changelog
  2. 246
      src/PwmConfig.cpp
  3. 86
      src/PwmConfig.h
  4. 3
      src/dialogs/DatabaseSettingsDlg.cpp
  5. 3
      src/dialogs/EditGroupDlg.cpp
  6. 15
      src/dialogs/PasswordDlg.cpp
  7. 7
      src/dialogs/PasswordGenDlg.cpp
  8. 5
      src/dialogs/SearchDlg.cpp
  9. 8
      src/forms/DatabaseSettingsDlg.ui
  10. 14
      src/forms/EditGroupDlg.ui
  11. 8
      src/forms/PasswordGenDlg.ui
  12. 18
      src/forms/SearchDlg.ui
  13. 76
      src/lib/FileDialogs.cpp
  14. 63
      src/lib/FileDialogs.h
  15. 8
      src/lib/KdePlugin.cpp
  16. 13
      src/lib/KdePlugin.h
  17. 19
      src/lib/KpFileIconProvider.cpp
  18. 28
      src/lib/KpFileIconProvider.h
  19. 13
      src/src.pro

@ -2,7 +2,14 @@
0.3.1
---------------
- made key/password dialog more user friendly
- added option for automatic database locking on inactivity
- native file dialogs are used again under MacOS X and Windows
- program accepts Qt command line switches like "-style" again
- parameter "-cfg" now accepts relative paths (Bug #1825446)
- fixed invalid entries in .desktop file (Bug #1906875)
- fixed potential compilation problem in AES implementation (Bug #1905810)
- fixed crash when re-arranging groups (Bug #1754998)
- fixed size problems of some dialogs
---------------
0.3.0a
@ -17,7 +24,7 @@
- global Auto-Type
- fully customizable HTML based detail view
- better structured settings dialog
- secure random number generator based on ‘Yarrow‘ including an optional entropy collector
- secure random number generator based on 'Yarrow' including an optional entropy collector
- new dialog to view expiered entries
- calendar widget to edit expiration dates in a more confortable way
- restructured password generator

@ -1,246 +0,0 @@
/***************************************************************************
* Copyright (C) 2005 by Tarek Saidi *
* mail@tarek-saidi.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 "PwmConfig.h"
#include <qobject.h>
#include <qdir.h>
#include <iostream>
using namespace std;
#ifdef Q_WS_MAC
#define DEFAULT_MOUNT_DIR "/Volumes/"
#endif
#ifdef Q_WS_X11
#define DEFAULT_MOUNT_DIR "/media/"
#endif
#ifdef Q_WS_WIN
#define DEFAULT_MOUNT_DIR "/"
#endif
#define CSTR(x)((const char*)x.toUtf8())
#define QSTR(x)(QString::fromUtf8((x).c_str()))
bool CConfig::loadFromIni(QString filename){
QString defaultSearchOptions = "001101111";
QString defaultPwGenOptions = "1111100001";
ini.SetPath((const char*)filename.toUtf8());
ini.ReadFile();
ClipboardTimeOut=ini.GetValueI("Options","ClipboardTimeOut",20);
Toolbar=ini.GetValueB("UI","ShowToolbar",true);
EntryDetails=ini.GetValueB("UI","ShowEntryDetails",true);
OpenLast=ini.GetValueB("Options","RememberLastFile",true);
LastFile=QSTR(ini.GetValue("Options","LastFile",""));
ParseColumnString(QSTR(ini.GetValue("UI","Columns","1111100000")),Columns);
BannerColor1=ParseColorString(QSTR(ini.GetValue("Options","BannerColor1","0,85,127")));
BannerColor2=ParseColorString(QSTR(ini.GetValue("Options","BannerColor2","0,117,175")));
BannerTextColor=ParseColorString(QSTR(ini.GetValue("Options","BannerTextColor","222,222,222")));
ShowPasswords=ini.GetValueB("Options","ShowPasswords",false);
ShowPasswordsPasswordDlg=ini.GetValueB("Options","ShowPasswordsPasswordDlg",false);
OpenUrlCommand=QSTR(ini.GetValue("Options","UrlCmd","kfmclient openURL %1"));
Language=QSTR(ini.GetValue("Options","LangFile",""));
ParseBoolString(QSTR(ini.GetValue("Options","SearchOptions",(const char*)defaultSearchOptions.toUtf8())),defaultSearchOptions,SearchOptions,9);
ListView_HidePasswords=ini.GetValueB("UI","HidePasswords",true);
ListView_HideUsernames=ini.GetValueB("UI","HideUsernames",false);
ParseBoolString(QSTR(ini.GetValue("Options","PwGenOptions",(const char*)defaultPwGenOptions.toUtf8())),defaultPwGenOptions,PwGenOptions,10);
PwGenLength=ini.GetValueI("Options","PwGenLength",25);
PwGenCharList=QSTR(ini.GetValue("Options","PwGenCharList",""));
ExpandGroupTree=ini.GetValueB("Options","ExpandGroupTree",true);
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(QSTR(ini.GetValue("UI","ColumnSizes","15,10,10,10,10,10,10,10,10,10")),ColumnSizes,10);
ShowStatusbar=ini.GetValueB("UI","ShowStatusbar",true);
AlternatingRowColors=ini.GetValueB("Options","AlternatingRowColors",true);
MountDir=QSTR(ini.GetValue("Options","MountDir",DEFAULT_MOUNT_DIR));
RememberLastKey=ini.GetValueB("Options","RememberLastKey",true);
LastKeyLocation=QSTR(ini.GetValue("Options","LastKeyLocation",""));
LastKeyType=(tKeyType)ini.GetValueI("Options","LastKeyType",(int)PASSWORD);
if(!OpenLast)RememberLastKey=false;
ToolbarIconSize=ini.GetValueI("UI","ToolbarIconSize",16);
ShowSysTrayIcon=ini.GetValueB("Options","ShowSysTrayIcon",false);
MinimizeToTray=ini.GetValueB("Options","MinimizeToTray",false);
SaveFileDlgHistory=ini.GetValueB("Options","SaveFileDlgHistory",true);
EnableBookmarkMenu=ini.GetValueB("Options","EnableBookmarkMenu",true);
GroupTreeRestore=ini.GetValueI("Options","GroupTreeRestore",1);
QString IntegrPluginVal=QSTR(ini.GetValue("Options","IntegrPlugin","None"));
if(IntegrPluginVal=="None")
IntegrPlugin=NONE;
else if(IntegrPluginVal=="Gnome")
IntegrPlugin=GNOME;
else if(IntegrPluginVal=="KDE")
IntegrPlugin=KDE;
else
IntegrPlugin=NONE;
return true;
}
bool CConfig::saveToIni(QString filename){
ini.SetValueI("Options","ClipboardTimeOut",ClipboardTimeOut);
ini.SetValueB("UI","ShowToolbar",Toolbar);
ini.SetValueB("UI","ShowEntryDetails",EntryDetails);
ini.SetValueB("Options","RememberLastFile",OpenLast);
if(OpenLast)ini.SetValue("Options","LastFile",(const char*)LastFile.toUtf8());
else ini.SetValue("Options","LastFile","");
ini.SetValue("UI","Columns",(const char*)CreateColumnString().toUtf8(),true);
ini.SetValue("Options","BannerColor1",(const char*)CreateColorString(BannerColor1).toUtf8(),true);
ini.SetValue("Options","BannerColor2",(const char*)CreateColorString(BannerColor2).toUtf8(),true);
ini.SetValue("Options","BannerTextColor",(const char*)CreateColorString(BannerTextColor).toUtf8(),true);
ini.SetValueB("Options","ShowPasswords",ShowPasswords,true);
ini.SetValueB("Options","ShowPasswordsPasswordDlg",ShowPasswordsPasswordDlg,true);
ini.SetValue("Options","UrlCmd",(const char*)OpenUrlCommand.toUtf8(),true);
ini.SetValue("Options","LangFile",(const char*)Language.toUtf8(),true);
ini.SetValue("Options","SearchOptions",(const char*)CreateBoolString(SearchOptions,9).toUtf8(),true);
ini.SetValueB("UI","HidePasswords",ListView_HidePasswords);
ini.SetValueB("UI","HideUsernames",ListView_HideUsernames);
ini.SetValue("Options","PwGenOptions",(const char*)CreateBoolString(PwGenOptions,10).toUtf8(),true);
ini.SetValueI("Options","PwGenLength",PwGenLength,true);
ini.SetValue("Options","PwGenCharList",(const char*)PwGenCharList.toUtf8(),true);
ini.SetValueB("Options","ExpandGroupTree",ExpandGroupTree,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).toUtf8(),true);
ini.SetValueB("UI","ShowStatusbar",ShowStatusbar);
ini.SetValueB("Options","AlternatingRowColors",AlternatingRowColors);
ini.SetValue("Options","MountDir",(const char*)MountDir.toUtf8());
ini.SetValueB("Options","RememberLastKey",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.SetValueI("Options","LastKeyType",LastKeyType);}
else{
ini.SetValue("Options","LastKeyLocation","");
ini.SetValueI("Options","LastKeyType",0);}
ini.SetValueI("UI","ToolbarIconSize",ToolbarIconSize,true);
if(IntegrPlugin==NONE)
ini.SetValue("Options","IntegrPlugin","None");
if(IntegrPlugin==GNOME)
ini.SetValue("Options","IntegrPlugin","Gnome");
if(IntegrPlugin==KDE)
ini.SetValue("Options","IntegrPlugin","KDE");
if(!ini.WriteFile())return false;
else return true;
}
void CConfig::ParseColumnString(QString str, bool* dst){
if(str.length()<10){
bool _default[]={true,true,true,true,true,false,false,false,false,false};
memcpy((char*)_default,(char*)dst,10*sizeof(bool));}
for(int i=0; i<10; i++){
if(str[i]==QChar('0'))
*(dst+i)=false;
else
*(dst+i)=true;
}
}
QString CConfig::CreateColumnString(){
QString str="";
for(int i=0;i<10;i++){
if(Columns[i])str+="1";
else str+="0";
}
return str;
}
QColor CConfig::ParseColorString(QString str){
QStringList lst=str.split(',');
if(lst.size()!=3){
qWarning((QObject::tr("Warning:")+" CConfig::ParseColorString(QString):"+QObject::tr("Invalid RGB color value.\n")).toUtf8());
return QColor(0,0,0);}
bool err[3];
int r=lst[0].toUInt(err);
int g=lst[1].toUInt(err+1);
int b=lst[2].toUInt(err+2);
if(!err[0] || !err[1] || !err[2]){
qWarning((QObject::tr("Warning:")+" CConfig::ParseColorString(QString):"+QObject::tr("Invalid RGB color value.\n")).toUtf8());
return QColor(0,0,0);}
return QColor(r,g,b);
}
QString CConfig::CreateColorString(QColor c){
return (QString::number(c.red())+","+QString::number(c.green())+","+QString::number(c.blue()));
}
void CConfig::ParseBoolString(const QString &str,const QString &defaults,bool* dst, int count){
Q_ASSERT(defaults.count() == count);
for(int i=0; i<count; i++){
QChar setting;
if(i < str.count()) setting = str[i];
else setting = defaults[i];
if(setting==QChar('0'))
*(dst+i)=false;
else
*(dst+i)=true;
}
}
QString CConfig::CreateBoolString(bool* src, int count){
QString str="";
for(int i=0;i<count;i++){
if(src[i])str+="1";
else str+="0";
}
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*sizeof(int));
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;
}

@ -1,86 +0,0 @@
/***************************************************************************
* Copyright (C) 2005 by Tarek Saidi *
* mail@tarek-saidi.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. *
***************************************************************************/
#ifndef _PWMCONFIG_H_
#define _PWMCONFIG_H_
#include <QColor>
#include "main.h"
#include "lib/IniReader.h"
class CConfig{
public:
enum IntegrPluginType{NONE,KDE,GNOME};
int TimeFormat;
int ClipboardTimeOut;
int MainWinHeight;
int MainWinWidth;
int MainWinSplit1;
int MainWinSplit2;
int ToolbarIconSize;
int PwGenLength;
int GroupTreeRestore; // 0:Restore Last; 1:Expand All; 2:Don't Expand
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 ShowPasswordsPasswordDlg;
bool ExpandGroupTree;
bool EnableKdePlugin;
bool ShowStatusbar;
bool AlternatingRowColors;
bool RememberLastKey;
bool ShowSysTrayIcon;
bool MinimizeToTray;
bool SaveFileDlgHistory;
bool EnableBookmarkMenu;
QString PwGenCharList;
QString MountDir;
QString LastKeyLocation;
QString OpenUrlCommand;
QString Language;
QString LastFile;
QColor BannerColor1;
QColor BannerColor2;
QColor BannerTextColor;
IntegrPluginType IntegrPlugin;
tKeyType LastKeyType;
bool loadFromIni(QString filename);
bool saveToIni(QString filename);
private:
CIniFile ini;
void ParseColumnString(QString str, bool* dst);
void ParseBoolString(const QString &str,const QString &defaults,bool* dst, int count);
void ParseIntString(const QString &str,int* dst, int count);
QString CreateBoolString(bool* src, int count);
QColor ParseColorString(QString str);
QString CreateColumnString();
QString CreateColorString(QColor);
QString CreateIntString(int* src, int count);
};
#endif

@ -27,6 +27,9 @@ CDbSettingsDlg::CDbSettingsDlg(QWidget* parent,IDatabase* db, bool modal, Qt::W
{
setupUi(this);
database=dynamic_cast<IKdbSettings*>(db);
adjustSize();
setMaximumSize(size());
setMinimumSize(size());
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width());
ComboAlgo->insertItem(0,tr("AES(Rijndael): 256 Bit (default)"));
ComboAlgo->insertItem(1,tr("Twofish: 256 Bit"));

@ -34,6 +34,9 @@ CEditGroupDialog::CEditGroupDialog(IDatabase* database,IGroupHandle* Handle,QWid
connect( ButtonBox, SIGNAL( accepted() ), this, SLOT( OnOK() ) );
connect( ButtonBox, SIGNAL( rejected() ), this, SLOT( OnCancel() ) );
connect( Button_Icon, SIGNAL( clicked() ), this, SLOT( OnIconDlg() ));
adjustSize();
setMaximumSize(size());
setMinimumSize(size());
}

@ -265,6 +265,21 @@ void PasswordDialog::OnOK(){
return;
}
if((Mode==Mode_Ask || Mode==Mode_Set) && config->rememberLastKey()){
if(Check_Password->isChecked() && Check_KeyFile->isChecked()){
config->setLastKeyType(BOTH);
config->setLastKeyLocation(Combo_KeyFile->currentText());
}
else if(Check_Password->isChecked()){
config->setLastKeyType(PASSWORD);
config->setLastKeyLocation(QString());
}
else if(Check_KeyFile->isChecked()){
config->setLastKeyType(PASSWORD);
config->setLastKeyLocation(Combo_KeyFile->currentText());
}
}
done(Exit_Ok);
}

@ -29,9 +29,6 @@ CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl)
: QDialog(parent,fl)
{
setupUi(this);
setMinimumSize(size());
setMaximumSize(size());
createBanner(&BannerPixmap,getPixmap("dice"),tr("Password Generator"),width());
connect(ButtonGenerate,SIGNAL(clicked()),this,SLOT(OnGeneratePw()));
connect(Radio_1,SIGNAL(toggled(bool)),this,SLOT(OnRadio1StateChanged(bool)));
connect(Radio_2,SIGNAL(toggled(bool)),this,SLOT(OnRadio2StateChanged(bool)));
@ -74,6 +71,10 @@ CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl)
OnRadio1StateChanged(pwGenOptions.at(0));
OnRadio2StateChanged(!pwGenOptions.at(0));
Spin_Num->setValue(config->pwGenLength());
adjustSize();
setMaximumSize(size());
setMinimumSize(size());
createBanner(&BannerPixmap,getPixmap("dice"),tr("Password Generator"),width());
}
CGenPwDialog::~CGenPwDialog(){

@ -30,7 +30,6 @@ SearchDialog::SearchDialog(IDatabase* database,IGroupHandle* Group,QWidget* pare
connect( ButtonBox, SIGNAL( rejected() ), this, SLOT( OnClose() ) );
db=database;
group=Group;
createBanner(&BannerPixmap,getPixmap("search"),tr("Search"),width());
QBitArray searchOptions=config->searchOptions();
checkBox_Cs->setChecked(searchOptions.at(0));
checkBox_regExp->setChecked(searchOptions.at(1));
@ -46,6 +45,10 @@ SearchDialog::SearchDialog(IDatabase* database,IGroupHandle* Group,QWidget* pare
checkBox_Recursive->setChecked(false);
checkBox_Recursive->setEnabled(false);
}
adjustSize();
setMaximumSize(size());
setMinimumSize(size());
createBanner(&BannerPixmap,getPixmap("search"),tr("Search"),width());
}
SearchDialog::~SearchDialog()

@ -18,13 +18,7 @@
<property name="minimumSize" >
<size>
<width>440</width>
<height>213</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>440</width>
<height>213</height>
<height>0</height>
</size>
</property>
<property name="windowTitle" >

@ -10,22 +10,10 @@
<height>120</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>350</width>
<height>120</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>350</width>
<height>120</height>
<height>0</height>
</size>
</property>
<property name="windowTitle" >

@ -6,15 +6,9 @@
<x>0</x>
<y>0</y>
<width>462</width>
<height>458</height>
<height>466</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Maximum" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<string>Password Generator</string>
</property>

@ -5,26 +5,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<height>280</height>
<width>458</width>
<height>306</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>390</width>
<height>280</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>390</width>
<height>280</height>
<height>0</height>
</size>
</property>
<property name="windowTitle" >

@ -5,7 +5,6 @@
* 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; version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
@ -70,40 +69,51 @@ QString KpxFileDialogs::saveFile(QWidget* Parent, const QString& Name, const QSt
return result;
}
QString QtStandardFileDialogs::openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter){
if(SelectedFilter >= Filters.size())
SelectedFilter=0;
QFileDialog FileDlg(parent,title,dir);
FileDlg.setFilters(Filters);
FileDlg.setFileMode(QFileDialog::ExistingFile);
FileDlg.selectFilter(Filters[SelectedFilter]);
if(!FileDlg.exec())return QString();
if(!FileDlg.selectedFiles().size())return QString();
LastFilter=FileDlg.filters().indexOf(FileDlg.selectedFilter());
return FileDlg.selectedFiles()[0];
}
QStringList QtStandardFileDialogs::openExistingFilesDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter){
QFileDialog FileDlg(parent,title,dir);
FileDlg.setFilters(Filters);
FileDlg.setFileMode(QFileDialog::ExistingFiles);
if(!FileDlg.exec())return QStringList();
LastFilter=FileDlg.filters().indexOf(FileDlg.selectedFilter());
return FileDlg.selectedFiles();
QString QtStandardFileDialogs::toSingleStringFilter(const QStringList& filterList){
if(!filterList.size())
return QString();
QString SingleString;
for(int i=0;i<filterList.size()-1;i++){
SingleString += filterList[i] + ";;";
}
SingleString += filterList.back();
return SingleString;
}
QString QtStandardFileDialogs::saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter, bool ShowOverwriteWarning){
QFileDialog FileDlg(parent,title,dir);
FileDlg.setFilters(Filters);
FileDlg.setFileMode(QFileDialog::AnyFile);
FileDlg.setAcceptMode(QFileDialog::AcceptSave);
FileDlg.setConfirmOverwrite(ShowOverwriteWarning);
if(!FileDlg.exec())return QString();
LastFilter=FileDlg.filters().indexOf(FileDlg.selectedFilter());
QString QtStandardFileDialogs::openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilterIndex){
QString SelectedFilter;
if(SelectedFilterIndex < Filters.size())
SelectedFilter=Filters[SelectedFilterIndex];
QString filename = QFileDialog::getOpenFileName(parent,title,dir,toSingleStringFilter(Filters),&SelectedFilter);
LastFilter=Filters.indexOf(SelectedFilter);
return filename;
}
QStringList QtStandardFileDialogs::openExistingFilesDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilterIndex){
QString SelectedFilter;
if(SelectedFilterIndex < Filters.size())
SelectedFilter=Filters[SelectedFilterIndex];
QStringList filenames = QFileDialog::getOpenFileNames(parent,title,dir,toSingleStringFilter(Filters),&SelectedFilter);
LastFilter=Filters.indexOf(SelectedFilter);
return filenames;
}
QString QtStandardFileDialogs::saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilterIndex, bool ShowOverwriteWarning){
QString SelectedFilter;
if(SelectedFilterIndex < Filters.size())
SelectedFilter=Filters[SelectedFilterIndex];
QString filepath = QFileDialog::getSaveFileName(parent,title,dir,toSingleStringFilter(Filters),&SelectedFilter,
ShowOverwriteWarning ? (QFileDialog::Option)0 : QFileDialog::DontConfirmOverwrite);
LastFilter=Filters.indexOf(SelectedFilter);
//Check whether the file has an extension which fits to the selected filter
QString filepath=FileDlg.selectedFiles()[0];
QString filename=filepath.right(filepath.length()-filepath.lastIndexOf("/")-1);
QFileInfo file(filepath);
QString filename=file.fileName();
int a=Filters[LastFilter].indexOf('(');
int b=Filters[LastFilter].indexOf(')');
QStringList Extensions=Filters[LastFilter].mid(a+1,b-a-1).split(" ");
@ -113,10 +123,8 @@ QString QtStandardFileDialogs::saveFileDialog(QWidget* parent,QString title,QStr
for(int i=0;i<Extensions.size();i++)
Extensions[i].remove(0,2); //remove the *. from the extensions
if(filename.contains(".")){
int p=filename.lastIndexOf(".");
QString ext=filename.right(filename.size()-p-1).toLower();
if(Extensions.contains(ext))
if(!file.suffix().isEmpty()){
if(Extensions.contains(file.suffix()))
return filepath;
else
return filepath+"."+Extensions[0];

@ -39,8 +39,12 @@ class FileDlgHistory:public QObject{
Entry(){Filter=-1;}
QString Dir;
int Filter;
bool isNull(){if(Filter==-1)return true;
else return false;}
bool isNull(){
if(Filter==-1)
return true;
else
return false;
}
};
QHash<QString,Entry>History;
@ -50,42 +54,39 @@ class FileDlgHistory:public QObject{
class KpxFileDialogs{
public:
static void setPlugin(IFileDialog* FileDlgPlugin);
static QString openExistingFile(QWidget* parent, const QString& Name,
const QString& Title,
const QStringList& Filters,
QString Dir=QString(),
int SelectedFilter=-1);
static QStringList openExistingFiles(QWidget* parent, const QString& Name,
const QString& Title,
const QStringList& Filters,
const QString Dir=QString(),
int SelectedFilter=-1);
static QString saveFile(QWidget* parent, const QString& Name,
const QString& Title,
const QStringList& Filters,
bool ShowOverwriteWarning=true,
QString Dir=QString(),
int SelectedFilter=-1);
static void setPlugin(IFileDialog* FileDlgPlugin);
static QString openExistingFile(QWidget* parent, const QString& Name,
const QString& Title,
const QStringList& Filters,
QString Dir=QString(),
int SelectedFilter=-1);
static QStringList openExistingFiles(QWidget* parent, const QString& Name,
const QString& Title,
const QStringList& Filters,
const QString Dir=QString(),
int SelectedFilter=-1);
static QString saveFile(QWidget* parent, const QString& Name,
const QString& Title,
const QStringList& Filters,
bool ShowOverwriteWarning=true,
QString Dir=QString(),
int SelectedFilter=-1);
private:
static IFileDialog* iFileDialog;
static IFileDialog* iFileDialog;
};
class QtStandardFileDialogs:public QObject,public IFileDialog{
Q_OBJECT
Q_INTERFACES(IFileDialog);
public:
QString openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter);
QStringList openExistingFilesDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter);
QString saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter,bool ShowOverwriteWarning);
int getLastFilter();
private:
int LastFilter;
public:
QString openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter);
QStringList openExistingFilesDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter);
QString saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter,bool ShowOverwriteWarning);
int getLastFilter();
private:
static QString toSingleStringFilter(const QStringList& filterList);
int LastFilter;
};
extern FileDlgHistory fileDlgHistory;

@ -1,8 +0,0 @@
#include "KdePlugin.h"
bool CKdePlugin::resolveSymbols(QLibrary& lib){
getAppObj=(QApplication*(*)(int,char**))lib.resolve("getAppObj");
if(getAppObj == NULL) return false;
return true;
}

@ -1,13 +0,0 @@
#ifndef _KDEPLUGIN_H_
#define _KDEPLUGIN_H_
#include <qlibrary.h>
#include <qapplication.h>
class CKdePlugin{
public:
bool resolveSymbols(QLibrary& lib);
QApplication*(*getAppObj)(int,char**);
};
#endif

@ -1,19 +0,0 @@
/***************************************************************************
* 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; version 2 of the License. *
* *
* 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. *
***************************************************************************/

@ -1,28 +0,0 @@
/***************************************************************************
* 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; version 2 of the License. *
* *
* 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;
};

@ -76,7 +76,10 @@ macx {
QMAKE_BUNDLE_DATA += data
ICON = ../share/macx_bundle/icon.icns
CONFIG += app_bundle
isEqual(ARCH,UNIVERSAL): CONFIG += x86 ppc
isEqual(ARCH,UNIVERSAL) {
CONFIG += x86 ppc
CONFIG -= precompile_header
}
isEqual(ARCH,INTEL): CONFIG += x86
isEqual(ARCH,PPC): CONFIG += ppc
SOURCES += main_macx.cpp
@ -170,7 +173,6 @@ HEADERS += lib/UrlLabel.h \
# dialogs/TrashCanDlg.h \
lib/random.h \
Database.h \
# lib/KdePlugin.h \
lib/AutoType.h \
lib/FileDialogs.h \
lib/ShortcutWidget.h \
@ -192,11 +194,10 @@ HEADERS += lib/UrlLabel.h \
crypto/sha1.h \
lib/WaitAnimationWidget.h \
plugins/interfaces/IFileDialog.h \
# plugins/interfaces/IKdeInit.h \
# plugins/interfaces/IGnomeInit.h \
plugins/interfaces/IKdeInit.h \
plugins/interfaces/IGnomeInit.h \
plugins/interfaces/IIconTheme.h \
KpxConfig.h \
# KpxFirefox.h \
dialogs/AddBookmarkDlg.h \
lib/bookmarks.h \
dialogs/ManageBookmarksDlg.h
@ -235,7 +236,6 @@ SOURCES += lib/UrlLabel.cpp \
lib/random.cpp \
Database.cpp \
lib/tools.cpp \
# lib/KdePlugin.cpp \
lib/GroupView.cpp \
lib/EntryView.cpp \
lib/FileDialogs.cpp \
@ -245,7 +245,6 @@ SOURCES += lib/UrlLabel.cpp \
crypto/yarrow.cpp \
lib/WaitAnimationWidget.cpp \
KpxConfig.cpp \
# KpxFirefox.cpp \
dialogs/AddBookmarkDlg.cpp \
lib/bookmarks.cpp \
dialogs/ManageBookmarksDlg.cpp \