Completely removed Qt3Support dependency

Cleaned up qmake project file
Compiles on Windows + many Windows specific improvements
Various small fixes

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@152 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 17 years ago
parent 18e99b5a41
commit 97da5c1989
  1. BIN
      share/ico/keepassx.ico
  2. 1
      share/ico/keepassx.rc
  3. 37
      src/dialogs/AboutDlg.cpp
  4. 5
      src/forms/AboutDlg.ui
  5. 2
      src/forms/EditGroupDlg.ui
  6. 2
      src/forms/SimplePasswordDlg.ui
  7. 4
      src/lib/ShortcutWidget.cpp
  8. 3
      src/lib/ShortcutWidget.h
  9. 68
      src/main.cpp
  10. 3
      src/main.h
  11. 24
      src/mainwindow.cpp
  12. 1
      src/mainwindow.h
  13. 105
      src/src.pro

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "keepassx.ico"

@ -42,7 +42,7 @@ AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
AboutTr+="<br>";
}
Edit_Translation->setHtml(AboutTr+tr("Information on how to translate KeePassX can be found under:")
+"<br>http://keepassx.sourceforge.net/");
+"<br>http://www.keepassx.org/");
QString str;
str+="<b>"+tr("Team")+"</b><br>";
str+="<div style='margin-left:10px;'>";
@ -77,34 +77,29 @@ close();
}
void AboutDialog::loadLicFromFile(){
QFile gpl(AppDir+"/../share/keepass/license.html");
if(!gpl.exists()){
QMessageBox::critical(this,tr("Error"),tr("File '%1' could not be found.")
QString filename;
filename = AppDir+"/../share/keepass/license.html";
if (!QFile::exists(filename)){
filename = AppDir+"/share/license.html";
if (!QFile::exists(filename)){
filename.clear();
}
}
QFile gpl(filename);
if (filename.isEmpty() || !gpl.open(QIODevice::ReadOnly)){
QMessageBox::critical(this,tr("Error"),tr("File '%1' could not be found.")
.arg("'license.html'")+"\n"+tr("Make sure that the program is installed correctly.")
,tr("OK"),0,0,2,1);
return;
}
if(!gpl.open(QIODevice::ReadOnly)){
QMessageBox::critical(this,tr("Error"),tr("Could not open file '%1'")
.arg("'license.txt'")+"\n"+tr("The following error occured:")+"\n"+gpl.errorString()
,tr("OK"),0,0,2,1);
return;
}
}
char* buffer=new char[gpl.size()];
long l=gpl.read(buffer,gpl.size());
gpl.close();
Edit_License->setHtml(QString::fromUtf8(buffer,l));
delete buffer;
Edit_License->setHtml(QString::fromUtf8(gpl.readAll()));
}
void AboutDialog::OnHomepageClicked(){
openBrowser("http://keepassx.sf.net");
openBrowser("http://www.keepassx.org/");
}
void AboutDialog::OnEMailClicked(){
openBrowser("mailto:keepassx@gmail.com");
openBrowser("mailto:keepassx@gmail.com");
}

@ -65,7 +65,7 @@
<item>
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab" >
<attribute name="title" >
@ -184,9 +184,6 @@
<property name="text" >
<string>http://keepassx.sourceforge.net</string>
</property>
<property name="buddy" >
<cstring></cstring>
</property>
</widget>
</item>
<item>

@ -132,11 +132,11 @@
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<tabstops>
<tabstop>EditTitle</tabstop>
<tabstop>ComboIconPicker</tabstop>
</tabstops>
<includes/>
<resources/>
<connections/>
</ui>

@ -125,7 +125,7 @@
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<includes/>
<resources/>
<connections/>
</ui>

@ -18,12 +18,14 @@
***************************************************************************/
#include "ShortcutWidget.h"
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_X11)
#include <QKeyEvent>
#include <QX11Info>
#include <QPalette>
#include "HelperX11.h"
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_X11)
ShortcutWidget::ShortcutWidget(QWidget* parent) : QLineEdit(parent), lock(false), failed(false){
}

@ -21,7 +21,10 @@
#define SHORTCUT_WIDGET_H
#include <QLineEdit>
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_X11)
#include "lib/AutoType.h"
#endif
class ShortcutWidget : public QLineEdit{
Q_OBJECT

@ -52,6 +52,9 @@
#if defined(Q_WS_X11) && defined(GLOBAL_AUTOTYPE)
#include "Application_X11.h"
#endif
#ifdef Q_WS_WIN
#include <windows.h>
#endif
using namespace std;
@ -60,6 +63,7 @@ QHash<QString,QIcon*>IconCache;
KpxConfig *config;
QString AppDir;
QString HomeDir;
QString PluginLoadError;
bool TrActive;
QString DetailViewTemplate;
@ -78,6 +82,15 @@ int main(int argc, char **_argv)
QString ArgFile,ArgCfg,ArgLang,IniFilename;
QApplication* app=NULL;
AppDir=applicationDirPath();
#if defined Q_WS_WIN
HomeDir = QString::fromLocal8Bit(qgetenv("APPDATA").constData());
if(!HomeDir.isEmpty() && QFile::exists(HomeDir))
HomeDir = QDir::fromNativeSeparators(HomeDir)+"/KeePassX";
else
HomeDir = QDir::homePath()+"/KeePassX";
#else
HomeDir = QDir::homePath()+"/.keepassx";
#endif
bool ArgMin = false;
bool ArgLock = false;
parseCmdLineArgs(argc,argv,ArgFile,ArgCfg,ArgLang,ArgMin,ArgLock);
@ -85,12 +98,12 @@ int main(int argc, char **_argv)
//Load Config
if(ArgCfg.isEmpty()){
if(!QDir(QDir::homePath()+"/.keepassx").exists()){
if(!QDir(HomeDir).exists()){
QDir conf(QDir::homePath());
if(!conf.mkdir(".keepassx")){
cout << "Warning: Could not create directory '~/.keepassx'." << endl;}
if(!QDir().mkpath(HomeDir))
qDebug("Warning: Could not create directory '%s'", CSTR(HomeDir));
}
IniFilename=QDir::homePath()+"/.keepassx/config";
IniFilename=HomeDir+"/config";
}
else
IniFilename=ArgCfg;
@ -163,8 +176,9 @@ int main(int argc, char **_argv)
qtTranslator=new QTranslator;
if(loadTranslation(translator,"keepass-",loc.name(),QStringList()
<< app->applicationDirPath()+"/../share/keepass/i18n/"
<< QDir::homePath()+"/.keepassx/" ))
<< AppDir+"/../share/keepass/i18n/"
<< AppDir+"/share/i18n/"
<< HomeDir))
{
app->installTranslator(translator);
TrActive=true;
@ -178,10 +192,12 @@ int main(int argc, char **_argv)
TrActive=false;
}
if(TrActive){
if(loadTranslation(qtTranslator,"qt_",loc.name(),QStringList()
<< QLibraryInfo::location(QLibraryInfo::TranslationsPath)
<< app->applicationDirPath()+"/../share/keepass/i18n/"
<< QDir::homePath()+"/.keepass/" ))
<< AppDir+"/../share/keepass/i18n/"
<< AppDir+"/share/i18n/"
<< HomeDir))
app->installTranslator(qtTranslator);
else{
if(loc.name()!="en_US")
@ -190,6 +206,7 @@ int main(int argc, char **_argv)
.arg(QLocale::countryToString(loc.country())).toAscii());
delete qtTranslator;
}
}
DetailViewTemplate=config->detailViewTemplate();
@ -281,7 +298,7 @@ void openBrowser(const QString& UrlString){
QUrl url(UrlString);
if(url.scheme().isEmpty())
url=QUrl("http://"+UrlString);
if(config->urlCmdDef()){
if(config->urlCmdDef() || url.scheme()=="mailto"){
QDesktopServices::openUrl(url);
}
else{
@ -297,22 +314,22 @@ void openBrowser(const QString& UrlString){
}
}
///TODO 0.2.3 remove
void loadImg(QString name,QPixmap& Img){
if(Img.load(AppDir+"/../share/keepass/icons/"+name)==false){
if(Img.load(AppDir+"/share/"+name)==false){
QString getImageFile(const QString& name){
if (QFile::exists(AppDir+"/../share/keepass/icons/"+name))
return AppDir+"/../share/keepass/icons/"+name;
else if (QFile::exists(AppDir+"/share/icons/"+name))
return AppDir+"/share/icons/"+name;
else{
QMessageBox::critical(0,QApplication::translate("Main","Error"),
QApplication::translate("Main","File '%1' could not be found.")
.arg(name),QApplication::translate("Main","OK"),0,0,2,1);
exit(1);
}
}
}
///TODO 0.2.3 remove
void loadImages(){
QPixmap tmpImg;
loadImg("clientic.png",tmpImg);
QPixmap tmpImg(getImageFile("clientic.png"));
EntryIcons=new QPixmap[BUILTIN_ICONS];
for(int i=0;i<BUILTIN_ICONS;i++){
EntryIcons[i]=tmpImg.copy(i*16,0,16,16);}
@ -336,12 +353,7 @@ const QIcon& getIcon(const QString& name){
}*/
if(!NewIcon)
{
QFileInfo IconFile(AppDir+"/../share/keepass/icons/"+name+".png");
if(!IconFile.isFile() || !IconFile.exists() || !IconFile.isReadable()){
///TODO 0.2.3 error handling
qWarning("%s",CSTR(name));
}
NewIcon=new QIcon(AppDir+"/../share/keepass/icons/"+name+".png");
NewIcon=new QIcon(getImageFile(name+".png"));
IconCache.insert(name,NewIcon);
}
return *NewIcon;
@ -351,11 +363,7 @@ const QPixmap* getPixmap(const QString& name){
QPixmap* CachedPixmap=PixmapCache.value(name);
if(CachedPixmap)
return CachedPixmap;
QImage img;
if(!img.load(AppDir+"/../share/keepass/icons/"+name+".png")){
///TODO 0.2.3 error handling
qWarning("%s",CSTR(name));
}
QImage img(getImageFile(name+".png"));
QPixmap* NewPixmap=new QPixmap(QPixmap::fromImage(img));
PixmapCache.insert(name,NewPixmap);
return NewPixmap;
@ -380,7 +388,7 @@ bool loadTranslation(QTranslator* tr,const QString& prefix,const QString& loc,co
void printHelp(){
cout << "KeePassX" << APP_VERSION << endl;
cout << "Usage: keepass [Filename] [Options]" << endl;
cout << "Usage: keepassx [Filename] [Options]" << endl;
cout << " -help This Help" << endl;
cout << " -cfg <CONFIG> Use specified file for loading/saving the configuration." << endl;
cout << " -min Start minimized." << endl;
@ -437,6 +445,8 @@ void showErrMsg(const QString& msg,QWidget* parent){
QMessageBox::critical(parent,QApplication::translate("Main","Error"),msg,QApplication::translate("Main","OK"));
}
//TODO Plugins
/*
QString findPlugin(const QString& filename){
QFileInfo info;
@ -446,7 +456,7 @@ QString findPlugin(const QString& filename){
return QString();
}
*/
QString makePathRelative(const QString& AbsDir,const QString& CurDir){
QStringList abs=AbsDir.split('/');

@ -54,12 +54,13 @@ QString applicationDirPath();
const QIcon& getIcon(const QString& name);
const QPixmap* getPixmap(const QString& name);
QString decodeFileError(QFile::FileError Code);
QString findPlugin(const QString& filename);
//QString findPlugin(const QString& filename); //TODO Plugins
QString makePathRelative(const QString& Abs,const QString& Cur);
extern QString PluginLoadError;
extern KpxConfig *config;
extern QString AppDir;
extern QString HomeDir;
extern bool TrActive;
extern QString DetailViewTemplate;
extern QPixmap *EntryIcons;

@ -78,7 +78,7 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,bool ArgMin,bool Arg
InUnLock=false;
unlockDlg=NULL;
setupUi(this);
#ifdef QT_WS_MAC
#ifdef Q_WS_MAC
setUnifiedTitleAndToolBarOnMac(true);
#endif
#ifdef AUTOTYPE
@ -218,6 +218,7 @@ void KeepassMainWindow::setupConnections(){
void KeepassMainWindow::setupToolbar(){
toolBar=new QToolBar(this);
toolBar->setMovable(false);
addToolBar(toolBar);
toolBar->setIconSize(QSize(config->toolbarIconSize(),config->toolbarIconSize()));
ViewShowToolbarAction=toolBar->toggleViewAction();
@ -269,6 +270,8 @@ void KeepassMainWindow::setupIcons(){
ExtrasSettingsAction->setIcon(getIcon("appsettings"));
#ifdef AUTOTYPE
EditAutoTypeAction->setIcon(getIcon("autotype"));
#else
EditAutoTypeAction->setVisible(false);
#endif
//HelpHandbookAction->setIcon(getIcon("manual")); //TODO Handbook
HelpAboutAction->setIcon(getIcon("help"));
@ -982,7 +985,11 @@ void KeepassMainWindow::hideEvent(QHideEvent* event){
if (config->lockOnMinimize() && !IsLocked && FileOpen)
OnUnLockWorkspace();
if (config->showSysTrayIcon() && config->minimizeTray()){
setVisible(false);
#ifdef Q_WS_WIN
QTimer::singleShot(100, this, SLOT(hide()));
#else
hide();
#endif
event->accept();
return;
}
@ -1091,11 +1098,20 @@ void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason rea
hide();
}
else{
#ifdef Q_WS_WIN
QTimer::singleShot(100, this, SLOT(restoreWindow()));
#else
restoreWindow();
#endif
}
}
}
void KeepassMainWindow::restoreWindow(){
showNormal();
activateWindow();
if (IsLocked)
OnUnLockWorkspace();
}
}
}
void KeepassMainWindow::OnExtrasPasswordGen(){

@ -92,6 +92,7 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
void OnShowSearchResults();
void OnEntryChanged(SelectionState);
void OnSysTrayActivated(QSystemTrayIcon::ActivationReason);
void restoreWindow();
void OnImport(QAction*);
void OnExport(QAction*);
void OnDetailViewUrlClicked(const QUrl& url);

@ -1,27 +1,30 @@
######################################################################
# Automatically generated by qmake (2.01a) Mo Jan 29 18:17:19 2007
######################################################################
DEPENDPATH += "crypto \
DEPENDPATH += crypto \
dialogs \
export \
forms \
import \
lib \
translations \
res"
res
win32:QMAKE_WIN32 = 1
MOC_DIR = ../build/moc
UI_DIR = ../build/ui
OBJECTS_DIR = ../build
RCC_DIR = ../build/rcc
INSTALLS += target data
data.files += ../share/keepass/*
TARGET = ../bin/keepassx
isEmpty(PREFIX){
PREFIX = /usr
}
unix : !macx : !isEqual(QMAKE_WIN32,1) {
isEmpty(PREFIX):PREFIX = /usr
unix : !macx {
!isEqual(AUTOTYPE,0){
!isEqual(AUTOTYPE,0) {
DEFINES += AUTOTYPE
!isEqual(GLOBAL_AUTOTYPE,0){
!isEqual(GLOBAL_AUTOTYPE,0) {
DEFINES += GLOBAL_AUTOTYPE
}
}
@ -32,32 +35,36 @@ unix : !macx {
desktop.files = ../share/applications/*
desktop.path = $${PREFIX}/share/applications
INSTALLS += pixmaps desktop
contains(DEFINES,AUTOTYPE){
contains(DEFINES,AUTOTYPE) {
LIBS += -lXtst
SOURCES += lib/HelperX11.cpp lib/AutoType_X11.cpp
HEADERS += lib/HelperX11.h
}
contains(DEFINES,GLOBAL_AUTOTYPE){
contains(DEFINES,GLOBAL_AUTOTYPE) {
SOURCES += Application_X11.cpp
HEADERS += Application_X11.h
}
}
contains(DEFINES,GLOBAL_AUTOTYPE){
FORMS += forms/AutoTypeDlg.ui
HEADERS += dialogs/AutoTypeDlg.h
SOURCES += dialogs/AutoTypeDlg.cpp
}
macx {
target.path = /Applications
data.path = /Applications/keepass.app/Contents/share/keepass
isEmpty(PREFIX):PREFIX = /Applications
target.path = $${PREFIX}
data.path = $${PREFIX}/keepassx.app/Contents/share/keepass
}
win32 {
TARGET = ../$$TARGET
QMAKE_LINK_OBJECT_SCRIPT = ../build/$$QMAKE_LINK_OBJECT_SCRIPT
isEqual(QMAKE_WIN32,1) {
isEmpty(PREFIX):PREFIX = "C:/Program files/KeePassX"
target.path = $${PREFIX}
data.path = $${PREFIX}/share
RC_FILE = ../share/ico/keepassx.rc
QMAKE_LINK_OBJECT_SCRIPT = $${OBJECTS_DIR}/$${QMAKE_LINK_OBJECT_SCRIPT}
}
contains(DEFINES,GLOBAL_AUTOTYPE) {
FORMS += forms/AutoTypeDlg.ui
HEADERS += dialogs/AutoTypeDlg.h
SOURCES += dialogs/AutoTypeDlg.cpp
}
FORMS += forms/EditGroupDlg.ui \
@ -79,14 +86,15 @@ FORMS += forms/EditGroupDlg.ui \
forms/WorkspaceLockedWidget.ui \
forms/AddBookmarkDlg.ui \
forms/ManageBookmarksDlg.ui
TRANSLATIONS += translations/keepass-de_DE.ts \
translations/keepass-ru_RU.ts \
translations/keepass-es_ES.ts \
translations/keepass-fr_FR.ts \
translations/keepass-cs_CS.ts \
translations/keepass-xx_XX.ts
HEADERS += lib/IniReader.h \
lib/UrlLabel.h \
HEADERS += lib/UrlLabel.h \
mainwindow.h \
Kdb3Database.h \
lib/SecString.h \
@ -138,8 +146,8 @@ HEADERS += lib/IniReader.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 \
@ -197,32 +205,33 @@ SOURCES += lib/UrlLabel.cpp \
# KpxFirefox.cpp \
dialogs/AddBookmarkDlg.cpp \
lib/bookmarks.cpp \
dialogs/ManageBookmarksDlg.cpp
dialogs/ManageBookmarksDlg.cpp
RESOURCES += res/resources.qrc
MOC_DIR = ../build/moc
UI_DIR = ../build/ui
OBJECTS_DIR = ../build/
RCC_DIR = ../build/rcc
CONFIG = qt \
uic \
resources \
thread \
stl \
warn_off
uic \
resources \
thread \
stl \
warn_off
QT += xml
TEMPLATE = app
INCLUDEPATH += . \
lib \
crypto \
plugins/interfaces \
export \
import \
dialogs \
./
isEqual(RELEASE,1){
lib \
crypto \
plugins/interfaces \
export \
import \
dialogs \
./
isEqual(RELEASE,1) {
CONFIG += release
}
else{
else {
CONFIG += debug
}
isEqual(QMAKE_WIN32,1) {
CONFIG += windows
}