Make source compile with QT5
This commit is contained in:
parent
e78117f906
commit
06b7abe50f
|
@ -883,7 +883,7 @@ void Kdb3Database::GroupHandle::setIndex(int index){
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Kdb3Database::convHexToBinaryKey(char* HexKey, char* dst){
|
bool Kdb3Database::convHexToBinaryKey(char* HexKey, char* dst){
|
||||||
QString hex=QString::fromAscii(HexKey,64);
|
QString hex=QString::fromLatin1(HexKey,64);
|
||||||
for(int i=0; i<64; i+=2){
|
for(int i=0; i<64; i+=2){
|
||||||
bool err;
|
bool err;
|
||||||
quint8 bin;
|
quint8 bin;
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
|
|
||||||
#include "lib/AutoType.h"
|
#include "lib/AutoType.h"
|
||||||
|
|
||||||
#if defined(Q_WS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
# define DEFAULT_MOUNT_DIR "/Volumes/"
|
# define DEFAULT_MOUNT_DIR "/Volumes/"
|
||||||
#elif defined(Q_WS_X11)
|
#elif defined(Q_OS_LINUX)
|
||||||
# define DEFAULT_MOUNT_DIR "/media/"
|
# define DEFAULT_MOUNT_DIR "/media/"
|
||||||
#elif defined(Q_WS_WIN)
|
#elif defined(Q_OS_WIN32)
|
||||||
# define DEFAULT_MOUNT_DIR "/"
|
# define DEFAULT_MOUNT_DIR "/"
|
||||||
#else
|
#else
|
||||||
# define DEFAULT_MOUNT_DIR QString()
|
# define DEFAULT_MOUNT_DIR QString()
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "Kdb3Database.h"
|
#include "Kdb3Database.h"
|
||||||
|
|
||||||
|
|
||||||
CDbSettingsDlg::CDbSettingsDlg(QWidget* parent,IDatabase* db, Qt::WFlags fl)
|
CDbSettingsDlg::CDbSettingsDlg(QWidget* parent,IDatabase* db, Qt::WindowFlags fl)
|
||||||
: QDialog(parent,fl)
|
: QDialog(parent,fl)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
|
@ -27,7 +27,7 @@ class CDbSettingsDlg : public QDialog, private Ui_DatabaseSettingsDlg
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CDbSettingsDlg(QWidget* parent,IDatabase* db, Qt::WFlags fl = 0 );
|
CDbSettingsDlg(QWidget* parent,IDatabase* db, Qt::WindowFlags fl = 0 );
|
||||||
~CDbSettingsDlg();
|
~CDbSettingsDlg();
|
||||||
virtual void paintEvent(QPaintEvent *);
|
virtual void paintEvent(QPaintEvent *);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ class CEditEntryDlg : public QDialog, private Ui_EditEntryDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* parent = 0, bool newEntry = FALSE);
|
CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* parent = 0, bool newEntry = false);
|
||||||
~CEditEntryDlg();
|
~CEditEntryDlg();
|
||||||
void InitGroupComboBox();
|
void InitGroupComboBox();
|
||||||
static void saveAttachment(IEntryHandle* pEntry, QWidget* ParentWidget=NULL);
|
static void saveAttachment(IEntryHandle* pEntry, QWidget* ParentWidget=NULL);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "EditGroupDlg.h"
|
#include "EditGroupDlg.h"
|
||||||
#include "SelectIconDlg.h"
|
#include "SelectIconDlg.h"
|
||||||
|
|
||||||
CEditGroupDialog::CEditGroupDialog(IDatabase* database,IGroupHandle* Handle,QWidget* parent, Qt::WFlags fl)
|
CEditGroupDialog::CEditGroupDialog(IDatabase* database,IGroupHandle* Handle,QWidget* parent, Qt::WindowFlags fl)
|
||||||
: QDialog(parent,fl)
|
: QDialog(parent,fl)
|
||||||
{
|
{
|
||||||
db = database;
|
db = database;
|
||||||
|
@ -35,7 +35,7 @@ CEditGroupDialog::CEditGroupDialog(IDatabase* database,IGroupHandle* Handle,QWid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CEditGroupDialog::CEditGroupDialog(IDatabase* database,CGroup* Group,QWidget* parent, Qt::WFlags fl)
|
CEditGroupDialog::CEditGroupDialog(IDatabase* database,CGroup* Group,QWidget* parent, Qt::WindowFlags fl)
|
||||||
: QDialog(parent,fl)
|
: QDialog(parent,fl)
|
||||||
{
|
{
|
||||||
db = database;
|
db = database;
|
||||||
|
|
|
@ -27,8 +27,8 @@ class CEditGroupDialog : public QDialog, private Ui_EditGroupDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CEditGroupDialog(IDatabase*,IGroupHandle*,QWidget* parent = 0, Qt::WFlags fl = 0 );
|
CEditGroupDialog(IDatabase*,IGroupHandle*,QWidget* parent = 0, Qt::WindowFlags fl = 0 );
|
||||||
CEditGroupDialog(IDatabase*,CGroup*,QWidget* parent = 0, Qt::WFlags fl = 0 );
|
CEditGroupDialog(IDatabase*,CGroup*,QWidget* parent = 0, Qt::WindowFlags fl = 0 );
|
||||||
~CEditGroupDialog();
|
~CEditGroupDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
bool CGenPwDialog::EntropyCollected=false;
|
bool CGenPwDialog::EntropyCollected=false;
|
||||||
|
|
||||||
CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl)
|
CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WindowFlags fl)
|
||||||
: QDialog(parent,fl)
|
: QDialog(parent,fl)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
|
@ -28,7 +28,7 @@ class CGenPwDialog : public QDialog, public Ui_GenPwDlg
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CGenPwDialog(QWidget* parent, bool StandAloneMode, Qt::WFlags fl = 0);
|
CGenPwDialog(QWidget* parent, bool StandAloneMode, Qt::WindowFlags fl = 0);
|
||||||
~CGenPwDialog();
|
~CGenPwDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "dialogs/SelectIconDlg.h"
|
#include "dialogs/SelectIconDlg.h"
|
||||||
|
|
||||||
|
|
||||||
CSelectIconDlg::CSelectIconDlg(IDatabase* database,int CurrentId,QWidget* parent, Qt::WFlags fl):QDialog(parent,fl){
|
CSelectIconDlg::CSelectIconDlg(IDatabase* database,int CurrentId,QWidget* parent, Qt::WindowFlags fl):QDialog(parent,fl){
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
db=database;
|
db=database;
|
||||||
Id=CurrentId;
|
Id=CurrentId;
|
||||||
|
|
|
@ -27,7 +27,7 @@ class CSelectIconDlg:public QDialog, private Ui_SelectIconDlg{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSelectIconDlg(IDatabase* db,int ImageID,QWidget* parent = 0, Qt::WFlags fl = 0);
|
CSelectIconDlg(IDatabase* db,int ImageID,QWidget* parent = 0, Qt::WindowFlags fl = 0);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void OnAddIcon();
|
void OnAddIcon();
|
||||||
|
|
|
@ -70,7 +70,7 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
|
||||||
Edit_GlobalShortcut->setVisible(false);
|
Edit_GlobalShortcut->setVisible(false);
|
||||||
CheckBox_EntryTitlesMatch->setVisible(false);
|
CheckBox_EntryTitlesMatch->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
CheckBox_AlwaysOnTop->setVisible(false);
|
CheckBox_AlwaysOnTop->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "SimplePasswordDlg.h"
|
#include "SimplePasswordDlg.h"
|
||||||
|
|
||||||
SimplePasswordDialog::SimplePasswordDialog(QWidget* parent, Qt::WFlags fl)
|
SimplePasswordDialog::SimplePasswordDialog(QWidget* parent, Qt::WindowFlags fl)
|
||||||
: QDialog(parent,fl)
|
: QDialog(parent,fl)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
|
@ -28,7 +28,7 @@ class SimplePasswordDialog : public QDialog, private Ui_SimplePasswordDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SimplePasswordDialog(QWidget* parent = 0, Qt::WFlags fl = 0 );
|
SimplePasswordDialog(QWidget* parent = 0, Qt::WindowFlags fl = 0 );
|
||||||
~SimplePasswordDialog();
|
~SimplePasswordDialog();
|
||||||
QString password;
|
QString password;
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ bool Import_KeePassX_Xml::parseEntry(const QDomElement& EntryElement,IGroupHandl
|
||||||
else if(ChildNodes.item(i).toElement().tagName()=="bindesc")
|
else if(ChildNodes.item(i).toElement().tagName()=="bindesc")
|
||||||
entry->setBinaryDesc(ChildNodes.item(i).toElement().text());
|
entry->setBinaryDesc(ChildNodes.item(i).toElement().text());
|
||||||
else if(ChildNodes.item(i).toElement().tagName()=="bin")
|
else if(ChildNodes.item(i).toElement().tagName()=="bin")
|
||||||
entry->setBinary(QByteArray::fromBase64(ChildNodes.item(i).toElement().text().toAscii()));
|
entry->setBinary(QByteArray::fromBase64(ChildNodes.item(i).toElement().text().toLatin1()));
|
||||||
else if(ChildNodes.item(i).toElement().tagName()=="comment"){
|
else if(ChildNodes.item(i).toElement().tagName()=="comment"){
|
||||||
QDomNodeList Lines=ChildNodes.item(i).childNodes();
|
QDomNodeList Lines=ChildNodes.item(i).childNodes();
|
||||||
QString comment;
|
QString comment;
|
||||||
|
|
|
@ -44,7 +44,7 @@ bool Import_PwManager::importDatabase(QWidget* GuiParent, IDatabase* db){
|
||||||
file->read(buffer,len);
|
file->read(buffer,len);
|
||||||
file->close();
|
file->close();
|
||||||
delete file;
|
delete file;
|
||||||
if(QString::fromAscii(buffer,17)!="PWM_PASSWORD_FILE")
|
if(QString::fromLatin1(buffer,17)!="PWM_PASSWORD_FILE")
|
||||||
{QMessageBox::critical(GuiParent,tr("Import Failed"),tr("File is no valid PwManager file.")); return false;}
|
{QMessageBox::critical(GuiParent,tr("Import Failed"),tr("File is no valid PwManager file.")); return false;}
|
||||||
offset+=17;
|
offset+=17;
|
||||||
if(buffer[offset]!=0x05)
|
if(buffer[offset]!=0x05)
|
||||||
|
@ -81,7 +81,7 @@ bool Import_PwManager::importDatabase(QWidget* GuiParent, IDatabase* db){
|
||||||
byte* Key=new byte[pwlen];
|
byte* Key=new byte[pwlen];
|
||||||
byte* xml=new byte[len-offset+1];
|
byte* xml=new byte[len-offset+1];
|
||||||
xml[len-offset]=0;
|
xml[len-offset]=0;
|
||||||
memcpy(Key,password.toAscii(),pwlen);
|
memcpy(Key,password.toLatin1(),pwlen);
|
||||||
QCryptographicHash sha(QCryptographicHash::Sha1);
|
QCryptographicHash sha(QCryptographicHash::Sha1);
|
||||||
sha.addData((const char*)Key,pwlen);
|
sha.addData((const char*)Key,pwlen);
|
||||||
QByteArray key_hash = sha.result();
|
QByteArray key_hash = sha.result();
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QMimeData>
|
||||||
|
#include <QDrag>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
@ -35,9 +38,9 @@ KeepassEntryView* pEntryView;*/
|
||||||
KeepassEntryView::KeepassEntryView(QWidget* parent) : QTreeWidget(parent) {
|
KeepassEntryView::KeepassEntryView(QWidget* parent) : QTreeWidget(parent) {
|
||||||
ViewMode=Normal;
|
ViewMode=Normal;
|
||||||
AutoResizeColumns = true;
|
AutoResizeColumns = true;
|
||||||
header()->setResizeMode(QHeaderView::Interactive);
|
header()->setSectionResizeMode(QHeaderView::Interactive);
|
||||||
header()->setStretchLastSection(false);
|
header()->setStretchLastSection(false);
|
||||||
header()->setClickable(true);
|
header()->setSectionsClickable(true);
|
||||||
header()->setCascadingSectionResizes(true);
|
header()->setCascadingSectionResizes(true);
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
retranslateColumns();
|
retranslateColumns();
|
||||||
|
@ -338,7 +341,7 @@ void KeepassEntryView::editEntry(EntryViewItem* item){
|
||||||
IEntryHandle* handle = item->EntryHandle;
|
IEntryHandle* handle = item->EntryHandle;
|
||||||
CEntry old = handle->data();
|
CEntry old = handle->data();
|
||||||
|
|
||||||
CEditEntryDlg dlg(db,handle,this,false);
|
CEditEntryDlg dlg(db,handle,this,true);
|
||||||
int result = dlg.exec();
|
int result = dlg.exec();
|
||||||
switch(result){
|
switch(result){
|
||||||
case 0: //canceled or no changes
|
case 0: //canceled or no changes
|
||||||
|
@ -483,7 +486,7 @@ void KeepassEntryView::OnClipboardTimeOut(){
|
||||||
if(Clipboard->supportsSelection()){
|
if(Clipboard->supportsSelection()){
|
||||||
Clipboard->clear(QClipboard::Selection);
|
Clipboard->clear(QClipboard::Selection);
|
||||||
}
|
}
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_OS_LINUX
|
||||||
QProcess::startDetached("dcop klipper klipper clearClipboardHistory");
|
QProcess::startDetached("dcop klipper klipper clearClipboardHistory");
|
||||||
QProcess::startDetached("dbus-send --type=method_call --dest=org.kde.klipper /klipper "
|
QProcess::startDetached("dbus-send --type=method_call --dest=org.kde.klipper /klipper "
|
||||||
"org.kde.klipper.klipper.clearClipboardHistory");
|
"org.kde.klipper.klipper.clearClipboardHistory");
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#if QT_VERSION >= 0x040400
|
#if QT_VERSION >= 0x040400
|
||||||
#include <QDesktopServices>
|
#include <QStandardPaths>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IFileDialog* KpxFileDialogs::iFileDialog=NULL;
|
IFileDialog* KpxFileDialogs::iFileDialog=NULL;
|
||||||
|
@ -155,7 +155,7 @@ QString FileDlgHistory::getDir(const QString& name){
|
||||||
Entry e=History.value(name);
|
Entry e=History.value(name);
|
||||||
if(e.isNull()) {
|
if(e.isNull()) {
|
||||||
#if QT_VERSION >= 0x040400
|
#if QT_VERSION >= 0x040400
|
||||||
return QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
|
return QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).at(0);
|
||||||
#else
|
#else
|
||||||
return QDir::homePath();
|
return QDir::homePath();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include "GroupView.h"
|
#include "GroupView.h"
|
||||||
#include "dialogs/EditGroupDlg.h"
|
#include "dialogs/EditGroupDlg.h"
|
||||||
|
|
||||||
|
#include <QDrag>
|
||||||
|
#include <QMimeData>
|
||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "ShortcutWidget.h"
|
#include "ShortcutWidget.h"
|
||||||
|
|
||||||
#if defined(GLOBAL_AUTOTYPE) && (defined(Q_WS_X11) || defined(Q_WS_MAC))
|
#if defined(GLOBAL_AUTOTYPE) && (defined(Q_OS_LINUX) || defined(Q_OS_MAC))
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
|
@ -62,7 +62,7 @@ void ShortcutWidget::keyEvent(QKeyEvent* event, bool release){
|
||||||
if (release && lock)
|
if (release && lock)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_OS_LINUX
|
||||||
AutoTypeGlobalX11* autoTypeGlobal = static_cast<AutoTypeGlobalX11*>(autoType);
|
AutoTypeGlobalX11* autoTypeGlobal = static_cast<AutoTypeGlobalX11*>(autoType);
|
||||||
|
|
||||||
unsigned int mods = HelperX11::keyboardModifiers(QX11Info::display());
|
unsigned int mods = HelperX11::keyboardModifiers(QX11Info::display());
|
||||||
|
@ -70,7 +70,7 @@ void ShortcutWidget::keyEvent(QKeyEvent* event, bool release){
|
||||||
mods & ShiftMask, mods & autoTypeGlobal->maskAlt(),
|
mods & ShiftMask, mods & autoTypeGlobal->maskAlt(),
|
||||||
mods & autoTypeGlobal->maskAltGr(), mods & autoTypeGlobal->maskMeta());
|
mods & autoTypeGlobal->maskAltGr(), mods & autoTypeGlobal->maskMeta());
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
AutoTypeGlobalMacX* autoTypeGlobal = static_cast<AutoTypeGlobalMacX*>(autoType);
|
AutoTypeGlobalMacX* autoTypeGlobal = static_cast<AutoTypeGlobalMacX*>(autoType);
|
||||||
quint32 mods = event->nativeModifiers();
|
quint32 mods = event->nativeModifiers();
|
||||||
// mods >> 16 bits denote outside main keyboard eg keypad, arrow keys, home, end, etc
|
// mods >> 16 bits denote outside main keyboard eg keypad, arrow keys, home, end, etc
|
||||||
|
@ -90,7 +90,7 @@ void ShortcutWidget::keyEvent(QKeyEvent* event, bool release){
|
||||||
void ShortcutWidget::displayShortcut(quint32 key, bool release, bool ctrl, bool shift, bool alt, bool altgr, bool win){
|
void ShortcutWidget::displayShortcut(quint32 key, bool release, bool ctrl, bool shift, bool alt, bool altgr, bool win){
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_OS_LINUX
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
text.append(tr("Ctrl")).append(" + ");
|
text.append(tr("Ctrl")).append(" + ");
|
||||||
if (shift)
|
if (shift)
|
||||||
|
@ -112,7 +112,7 @@ void ShortcutWidget::displayShortcut(quint32 key, bool release, bool ctrl, bool
|
||||||
text.append(static_cast<quint32>(keysym));
|
text.append(static_cast<quint32>(keysym));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
text.append(kControlUnicode);
|
text.append(kControlUnicode);
|
||||||
if (shift)
|
if (shift)
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#define SHORTCUT_WIDGET_H
|
#define SHORTCUT_WIDGET_H
|
||||||
|
|
||||||
|
|
||||||
#if defined(GLOBAL_AUTOTYPE) && (defined(Q_WS_X11) || defined(Q_WS_MAC))
|
#if defined(GLOBAL_AUTOTYPE) && (defined(Q_OS_LINUX) || defined(Q_OS_MAC))
|
||||||
#include "lib/AutoType.h"
|
#include "lib/AutoType.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class ShortcutWidget : public QLineEdit{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ShortcutWidget(QWidget* parent = 0);
|
ShortcutWidget(QWidget* parent = 0);
|
||||||
#if defined(GLOBAL_AUTOTYPE) && (defined(Q_WS_X11) || defined(Q_WS_MAC))
|
#if defined(GLOBAL_AUTOTYPE) && (defined(Q_OS_LINUX) || defined(Q_OS_MAC))
|
||||||
Shortcut shortcut();
|
Shortcut shortcut();
|
||||||
void setShortcut(const Shortcut& s);
|
void setShortcut(const Shortcut& s);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "UrlLabel.h"
|
#include "UrlLabel.h"
|
||||||
|
|
||||||
LinkLabel::LinkLabel(QWidget *parent,const QString& text, int x, int y,Qt::WFlags f) : QLabel(parent,f){
|
LinkLabel::LinkLabel(QWidget *parent,const QString& text, int x, int y,Qt::WindowFlags f) : QLabel(parent,f){
|
||||||
QFont font(parentWidget()->font());
|
QFont font(parentWidget()->font());
|
||||||
font.setUnderline(true);
|
font.setUnderline(true);
|
||||||
setFont(font);
|
setFont(font);
|
||||||
|
|
|
@ -25,7 +25,7 @@ class LinkLabel : public QLabel{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LinkLabel(QWidget *parent,const QString& text=QString::null, int x=0, int y=0,Qt::WFlags f=0);
|
LinkLabel(QWidget *parent,const QString& text=QString::null, int x=0, int y=0,Qt::WindowFlags f=0);
|
||||||
~LinkLabel();
|
~LinkLabel();
|
||||||
void setPos(int x,int y);
|
void setPos(int x,int y);
|
||||||
QString url();
|
QString url();
|
||||||
|
|
|
@ -21,9 +21,11 @@
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
|
|
||||||
|
|
||||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#elif defined(Q_WS_WIN)
|
#elif defined(Q_OS_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <wincrypt.h>
|
#include <wincrypt.h>
|
||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
|
@ -57,7 +59,7 @@ quint32 randintRange(quint32 min, quint32 max){
|
||||||
return min + randint(max-min+1);
|
return min + randint(max-min+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
|
|
||||||
extern bool getNativeEntropy(quint8* buffer, int length) {
|
extern bool getNativeEntropy(quint8* buffer, int length) {
|
||||||
QFile dev_urandom("/dev/urandom");
|
QFile dev_urandom("/dev/urandom");
|
||||||
|
@ -66,7 +68,7 @@ extern bool getNativeEntropy(quint8* buffer, int length) {
|
||||||
return (dev_urandom.read((char*)buffer,length) == length);
|
return (dev_urandom.read((char*)buffer,length) == length);
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(Q_WS_WIN)
|
#elif defined(Q_OS_WIN32)
|
||||||
|
|
||||||
extern bool getNativeEntropy(quint8* buffer, int length) {
|
extern bool getNativeEntropy(quint8* buffer, int length) {
|
||||||
HCRYPTPROV handle;
|
HCRYPTPROV handle;
|
||||||
|
@ -92,7 +94,7 @@ extern void initStdRand(){
|
||||||
stream << QCursor::pos();
|
stream << QCursor::pos();
|
||||||
stream << QDateTime::currentDateTime().toTime_t();
|
stream << QDateTime::currentDateTime().toTime_t();
|
||||||
stream << QTime::currentTime().msec();
|
stream << QTime::currentTime().msec();
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_OS_WIN32
|
||||||
stream << (quint32) GetCurrentProcessId();
|
stream << (quint32) GetCurrentProcessId();
|
||||||
#else
|
#else
|
||||||
stream << getpid();
|
stream << getpid();
|
||||||
|
|
|
@ -22,10 +22,10 @@
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#elif defined(Q_WS_WIN)
|
#elif defined(Q_OS_WIN32)
|
||||||
#include <QLibrary>
|
#include <QLibrary>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
@ -48,7 +48,10 @@ void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,i
|
||||||
QPixmap Icon(32,32);
|
QPixmap Icon(32,32);
|
||||||
if(IconAlpha){
|
if(IconAlpha){
|
||||||
Icon.fill(TextColor);
|
Icon.fill(TextColor);
|
||||||
Icon.setAlphaChannel(*IconAlpha);
|
// TODO Hier Fix!
|
||||||
|
// Icon.setAlphaChannel(*IconAlpha);
|
||||||
|
// QPainter::setCompositionMode(QPainter::CompositionMode_SourceOver)
|
||||||
|
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
||||||
painter.drawPixmap(10,10,Icon);
|
painter.drawPixmap(10,10,Icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,9 +223,9 @@ bool createKeyFile(const QString& filename,QString* error,int length, bool Hex){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lockPage(void* addr, int len){
|
bool lockPage(void* addr, int len){
|
||||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
return (mlock(addr, len)==0);
|
return (mlock(addr, len)==0);
|
||||||
#elif defined(Q_WS_WIN)
|
#elif defined(Q_OS_WIN32)
|
||||||
return VirtualLock(addr, len);
|
return VirtualLock(addr, len);
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
@ -230,9 +233,9 @@ bool lockPage(void* addr, int len){
|
||||||
}
|
}
|
||||||
|
|
||||||
bool unlockPage(void* addr, int len){
|
bool unlockPage(void* addr, int len){
|
||||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
return (munlock(addr, len)==0);
|
return (munlock(addr, len)==0);
|
||||||
#elif defined(Q_WS_WIN)
|
#elif defined(Q_OS_WIN)
|
||||||
return VirtualUnlock(addr, len);
|
return VirtualUnlock(addr, len);
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
@ -242,9 +245,9 @@ bool unlockPage(void* addr, int len){
|
||||||
bool syncFile(QFile* file) {
|
bool syncFile(QFile* file) {
|
||||||
if (!file->flush())
|
if (!file->flush())
|
||||||
return false;
|
return false;
|
||||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
return (fsync(file->handle())==0);
|
return (fsync(file->handle())==0);
|
||||||
#elif defined(Q_WS_WIN)
|
#elif defined(Q_OS_WIN32)
|
||||||
return (_commit(file->handle())==0);
|
return (_commit(file->handle())==0);
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
|
26
src/main.cpp
26
src/main.cpp
|
@ -21,10 +21,10 @@
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#if defined(Q_WS_X11) && defined(GLOBAL_AUTOTYPE)
|
#if defined(Q_OS_LINUX) && defined(GLOBAL_AUTOTYPE)
|
||||||
#include "Application_X11.h"
|
#include "Application_X11.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_OS_WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ IIconTheme* IconLoader=NULL;
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_OS_WIN32
|
||||||
// Make sure Windows doesn't load DLLs from the current working directory
|
// Make sure Windows doesn't load DLLs from the current working directory
|
||||||
SetDllDirectoryA("");
|
SetDllDirectoryA("");
|
||||||
SetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE);
|
SetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE);
|
||||||
|
@ -60,7 +60,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
|
|
||||||
#if defined(Q_WS_X11) && defined(AUTOTYPE)
|
#if defined(Q_OS_LINUX) && defined(AUTOTYPE)
|
||||||
QApplication* app = new KeepassApplication(argc,argv);
|
QApplication* app = new KeepassApplication(argc,argv);
|
||||||
#else
|
#else
|
||||||
QApplication* app = new QApplication(argc,argv);
|
QApplication* app = new QApplication(argc,argv);
|
||||||
|
@ -72,7 +72,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
AppDir = QApplication::applicationFilePath();
|
AppDir = QApplication::applicationFilePath();
|
||||||
AppDir.truncate(AppDir.lastIndexOf("/"));
|
AppDir.truncate(AppDir.lastIndexOf("/"));
|
||||||
#if defined(Q_WS_X11)
|
#if defined(Q_OS_LINUX)
|
||||||
DataDir = AppDir+"/../share/keepassx";
|
DataDir = AppDir+"/../share/keepassx";
|
||||||
if (!QFile::exists(DataDir) && QFile::exists(AppDir+"/share"))
|
if (!QFile::exists(DataDir) && QFile::exists(AppDir+"/share"))
|
||||||
DataDir = AppDir+"/share";
|
DataDir = AppDir+"/share";
|
||||||
|
@ -88,11 +88,11 @@ int main(int argc, char **argv)
|
||||||
HomeDir = QDir::homePath() + '/' + qenv;
|
HomeDir = QDir::homePath() + '/' + qenv;
|
||||||
}
|
}
|
||||||
HomeDir += "/keepassx";
|
HomeDir += "/keepassx";
|
||||||
#elif defined(Q_WS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
HomeDir = QDir::homePath()+"/.keepassx";
|
HomeDir = QDir::homePath()+"/.keepassx";
|
||||||
DataDir = AppDir+"/../Resources/keepassx";
|
DataDir = AppDir+"/../Resources/keepassx";
|
||||||
#else //Q_WS_WIN
|
#elif defined(Q_OS_WIN32)
|
||||||
HomeDir = qtWindowsConfigPath(CSIDL_APPDATA);
|
HomeDir = qtWindowsConfigPath(0);
|
||||||
if(!HomeDir.isEmpty() && QFile::exists(HomeDir))
|
if(!HomeDir.isEmpty() && QFile::exists(HomeDir))
|
||||||
HomeDir = QDir::fromNativeSeparators(HomeDir)+"/KeePassX";
|
HomeDir = QDir::fromNativeSeparators(HomeDir)+"/KeePassX";
|
||||||
else
|
else
|
||||||
|
@ -126,7 +126,7 @@ int main(int argc, char **argv)
|
||||||
else
|
else
|
||||||
IniFilename=args.configLocation();
|
IniFilename=args.configLocation();
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_OS_LINUX
|
||||||
{
|
{
|
||||||
QString OldHomeDir = QDir::homePath()+"/.keepassx";
|
QString OldHomeDir = QDir::homePath()+"/.keepassx";
|
||||||
if (args.configLocation().isEmpty() && QFile::exists(OldHomeDir+"/config") && !QFile::exists(HomeDir+"/config")) {
|
if (args.configLocation().isEmpty() && QFile::exists(OldHomeDir+"/config") && !QFile::exists(HomeDir+"/config")) {
|
||||||
|
@ -144,7 +144,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
// PlugIns
|
// PlugIns
|
||||||
/*
|
/*
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_OS_LINUX
|
||||||
if(config->integrPlugin()!=KpxConfig::NoIntegr){
|
if(config->integrPlugin()!=KpxConfig::NoIntegr){
|
||||||
QString LibName="libkeepassx-";
|
QString LibName="libkeepassx-";
|
||||||
if(config->integrPlugin()==KpxConfig::KDE)
|
if(config->integrPlugin()==KpxConfig::KDE)
|
||||||
|
@ -199,7 +199,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
installTranslator();
|
installTranslator();
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
if (args.file().isEmpty() && !eventListener->file().isEmpty()) {
|
if (args.file().isEmpty() && !eventListener->file().isEmpty()) {
|
||||||
args.setFile(eventListener->file());
|
args.setFile(eventListener->file());
|
||||||
|
@ -207,7 +207,7 @@ int main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
KeepassMainWindow *mainWin = new KeepassMainWindow(args.file(), args.startMinimized(), args.startLocked());
|
KeepassMainWindow *mainWin = new KeepassMainWindow(args.file(), args.startMinimized(), args.startLocked());
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
eventListener->setMainWin(mainWin);
|
eventListener->setMainWin(mainWin);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ bool EventListener::eventFilter(QObject*, QEvent* event){
|
||||||
EventOccurred = true;
|
EventOccurred = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
if (event->type() == QEvent::FileOpen) {
|
if (event->type() == QEvent::FileOpen) {
|
||||||
QString filename = static_cast<QFileOpenEvent*>(event)->file();
|
QString filename = static_cast<QFileOpenEvent*>(event)->file();
|
||||||
if (pMainWindow) {
|
if (pMainWindow) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ private:
|
||||||
class EventListener : public QObject {
|
class EventListener : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
public:
|
public:
|
||||||
EventListener() { pMainWindow = NULL; };
|
EventListener() { pMainWindow = NULL; };
|
||||||
inline QString file() { return pFile; };
|
inline QString file() { return pFile; };
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#include "dialogs/ManageBookmarksDlg.h"
|
#include "dialogs/ManageBookmarksDlg.h"
|
||||||
#include "dialogs/HelpDlg.h"
|
#include "dialogs/HelpDlg.h"
|
||||||
|
|
||||||
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_MAC)
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_OS_MAC)
|
||||||
#include "lib/HelperMacX.h"
|
#include "lib/HelperMacX.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ Import_KWalletXml import_KWalletXml;
|
||||||
Export_Txt export_Txt;
|
Export_Txt export_Txt;
|
||||||
Export_KeePassX_Xml export_KeePassX_Xml;
|
Export_KeePassX_Xml export_KeePassX_Xml;
|
||||||
|
|
||||||
KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,bool ArgMin,bool ArgLock,QWidget *parent, Qt::WFlags flags) :QMainWindow(parent,flags){
|
KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,bool ArgMin,bool ArgLock,QWidget *parent, Qt::WindowFlags flags) :QMainWindow(parent,flags){
|
||||||
ShutingDown=false;
|
ShutingDown=false;
|
||||||
IsLocked=false;
|
IsLocked=false;
|
||||||
EventOccurred=true;
|
EventOccurred=true;
|
||||||
|
@ -62,7 +62,7 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,bool ArgMin,bool Arg
|
||||||
unlockDlg=NULL;
|
unlockDlg=NULL;
|
||||||
db=NULL;
|
db=NULL;
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
setUnifiedTitleAndToolBarOnMac(true);
|
setUnifiedTitleAndToolBarOnMac(true);
|
||||||
#endif
|
#endif
|
||||||
#ifdef AUTOTYPE
|
#ifdef AUTOTYPE
|
||||||
|
@ -89,7 +89,7 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,bool ArgMin,bool Arg
|
||||||
//statusBar()->addWidget(StatusBarSelection,85);
|
//statusBar()->addWidget(StatusBarSelection,85);
|
||||||
statusBar()->setVisible(config->showStatusbar());
|
statusBar()->setVisible(config->showStatusbar());
|
||||||
setStatusBarMsg(StatusBarReady);
|
setStatusBarMsg(StatusBarReady);
|
||||||
#ifndef Q_WS_MAC
|
#ifndef Q_OS_MAC
|
||||||
if (config->alwaysOnTop())
|
if (config->alwaysOnTop())
|
||||||
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
||||||
#endif
|
#endif
|
||||||
|
@ -190,7 +190,7 @@ void KeepassMainWindow::setupConnections(){
|
||||||
connect(ViewToolButtonSize22Action,SIGNAL(toggled(bool)), this, SLOT(OnViewToolbarIconSize22(bool)));
|
connect(ViewToolButtonSize22Action,SIGNAL(toggled(bool)), this, SLOT(OnViewToolbarIconSize22(bool)));
|
||||||
connect(ViewToolButtonSize28Action,SIGNAL(toggled(bool)), this, SLOT(OnViewToolbarIconSize28(bool)));
|
connect(ViewToolButtonSize28Action,SIGNAL(toggled(bool)), this, SLOT(OnViewToolbarIconSize28(bool)));
|
||||||
connect(ViewShowStatusbarAction,SIGNAL(toggled(bool)),statusBar(),SLOT(setVisible(bool)));
|
connect(ViewShowStatusbarAction,SIGNAL(toggled(bool)),statusBar(),SLOT(setVisible(bool)));
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
connect(ViewMinimizeAction, SIGNAL(triggered()), SLOT(showMinimized()));
|
connect(ViewMinimizeAction, SIGNAL(triggered()), SLOT(showMinimized()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ void KeepassMainWindow::setupMenus(){
|
||||||
case 28: ViewToolButtonSize28Action->setChecked(true); break;
|
case 28: ViewToolButtonSize28Action->setChecked(true); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
ViewMenu->addSeparator();
|
ViewMenu->addSeparator();
|
||||||
ViewMenu->addAction(ViewMinimizeAction);
|
ViewMenu->addAction(ViewMinimizeAction);
|
||||||
#endif
|
#endif
|
||||||
|
@ -382,7 +382,7 @@ void KeepassMainWindow::setupMenus(){
|
||||||
#ifdef AUTOTYPE
|
#ifdef AUTOTYPE
|
||||||
EditAutoTypeAction->setShortcut(tr("Ctrl+V"));
|
EditAutoTypeAction->setShortcut(tr("Ctrl+V"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_OS_MAC
|
||||||
FileSaveAsAction->setShortcut(tr("Shift+Ctrl+S"));
|
FileSaveAsAction->setShortcut(tr("Shift+Ctrl+S"));
|
||||||
EditGroupSearchAction->setShortcut(tr("Shift+Ctrl+F"));
|
EditGroupSearchAction->setShortcut(tr("Shift+Ctrl+F"));
|
||||||
ViewMinimizeAction->setShortcut(tr("Ctrl+M"));
|
ViewMinimizeAction->setShortcut(tr("Ctrl+M"));
|
||||||
|
@ -437,7 +437,7 @@ bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
|
||||||
QPushButton* readOnlyButton = new QPushButton(tr("Open read-only"), &msgBox);
|
QPushButton* readOnlyButton = new QPushButton(tr("Open read-only"), &msgBox);
|
||||||
msgBox.addButton(readOnlyButton, QMessageBox::AcceptRole);
|
msgBox.addButton(readOnlyButton, QMessageBox::AcceptRole);
|
||||||
msgBox.setDefaultButton(readOnlyButton);
|
msgBox.setDefaultButton(readOnlyButton);
|
||||||
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_MAC)
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_OS_MAC)
|
||||||
// On MacX, QMessageBox is not brought to foreground on exec() when app not already there
|
// On MacX, QMessageBox is not brought to foreground on exec() when app not already there
|
||||||
HelperMacX::processToFront(HelperMacX::getKeepassxPID());
|
HelperMacX::processToFront(HelperMacX::getKeepassxPID());
|
||||||
#endif
|
#endif
|
||||||
|
@ -462,7 +462,7 @@ bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
|
||||||
dlg.setWindowModality(Qt::WindowModal);
|
dlg.setWindowModality(Qt::WindowModal);
|
||||||
unlockDlg = &dlg;
|
unlockDlg = &dlg;
|
||||||
}
|
}
|
||||||
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_MAC)
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_OS_MAC)
|
||||||
// On MacX, QMessageBox is not brought to foreground on exec() when app not already there
|
// On MacX, QMessageBox is not brought to foreground on exec() when app not already there
|
||||||
HelperMacX::processToFront(HelperMacX::getKeepassxPID());
|
HelperMacX::processToFront(HelperMacX::getKeepassxPID());
|
||||||
#endif
|
#endif
|
||||||
|
@ -590,7 +590,7 @@ void KeepassMainWindow::OnFileNewKdb(){
|
||||||
IDatabase* db_new=dynamic_cast<IDatabase*>(new Kdb3Database());
|
IDatabase* db_new=dynamic_cast<IDatabase*>(new Kdb3Database());
|
||||||
db_new->create();
|
db_new->create();
|
||||||
PasswordDialog dlg(this,PasswordDialog::Mode_Set,PasswordDialog::Flag_None,"New Database");
|
PasswordDialog dlg(this,PasswordDialog::Mode_Set,PasswordDialog::Flag_None,"New Database");
|
||||||
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_MAC)
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_OS_MAC)
|
||||||
// On MacX, QMessageBox is not brought to foreground on exec()
|
// On MacX, QMessageBox is not brought to foreground on exec()
|
||||||
HelperMacX::processToFront(HelperMacX::getKeepassxPID());
|
HelperMacX::processToFront(HelperMacX::getKeepassxPID());
|
||||||
#endif
|
#endif
|
||||||
|
@ -742,27 +742,27 @@ void KeepassMainWindow::updateDetailView(){
|
||||||
QString templ=DetailViewTemplate;
|
QString templ=DetailViewTemplate;
|
||||||
IEntryHandle* entry=((EntryViewItem*)(EntryView->selectedItems()[0]))->EntryHandle;
|
IEntryHandle* entry=((EntryViewItem*)(EntryView->selectedItems()[0]))->EntryHandle;
|
||||||
|
|
||||||
templ.replace("%group%", Qt::escape(entry->group()->title()));
|
templ.replace("%group%", QString(entry->group()->title()).toHtmlEscaped());
|
||||||
templ.replace("%title%", Qt::escape(entry->title()));
|
templ.replace("%title%", QString(entry->title()).toHtmlEscaped());
|
||||||
if (config->hideUsernames())
|
if (config->hideUsernames())
|
||||||
templ.replace("%username%","****");
|
templ.replace("%username%","****");
|
||||||
else
|
else
|
||||||
templ.replace("%username%", Qt::escape(entry->username()));
|
templ.replace("%username%", QString(entry->username()).toHtmlEscaped());
|
||||||
if (!config->hidePasswords()) {
|
if (!config->hidePasswords()) {
|
||||||
SecString password=entry->password();
|
SecString password=entry->password();
|
||||||
password.unlock();
|
password.unlock();
|
||||||
templ.replace("%password%", Qt::escape(password.string()));
|
templ.replace("%password%", QString(password.string()).toHtmlEscaped());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
templ.replace("%password%","****");
|
templ.replace("%password%","****");
|
||||||
}
|
}
|
||||||
templ.replace("%url%", Qt::escape(entry->url()));
|
templ.replace("%url%", QString(entry->url()).toHtmlEscaped());
|
||||||
templ.replace("%creation%", Qt::escape(entry->creation().toString(Qt::SystemLocaleDate)));
|
templ.replace("%creation%", QString(entry->creation().toString(Qt::SystemLocaleDate)).toHtmlEscaped());
|
||||||
templ.replace("%lastmod%", Qt::escape(entry->lastMod().toString(Qt::SystemLocaleDate)));
|
templ.replace("%lastmod%", QString(entry->lastMod().toString(Qt::SystemLocaleDate)).toHtmlEscaped());
|
||||||
templ.replace("%lastaccess%", Qt::escape(entry->lastAccess().toString(Qt::SystemLocaleDate)));
|
templ.replace("%lastaccess%", QString(entry->lastAccess().toString(Qt::SystemLocaleDate)).toHtmlEscaped());
|
||||||
templ.replace("%expire%", Qt::escape(entry->expire().toString(Qt::SystemLocaleDate)));
|
templ.replace("%expire%", QString(entry->expire().toString(Qt::SystemLocaleDate)).toHtmlEscaped());
|
||||||
templ.replace("%comment%", Qt::escape(entry->comment()).replace("\n","<br/>"));
|
templ.replace("%comment%", QString(entry->comment().replace("\n","<br/>")).toHtmlEscaped());
|
||||||
templ.replace("%attachment%", Qt::escape(entry->binaryDesc()));
|
templ.replace("%attachment%", QString(entry->binaryDesc()).toHtmlEscaped());
|
||||||
|
|
||||||
if(entry->expire()!=Date_Never){
|
if(entry->expire()!=Date_Never){
|
||||||
int secs=QDateTime::currentDateTime().secsTo(entry->expire());
|
int secs=QDateTime::currentDateTime().secsTo(entry->expire());
|
||||||
|
@ -1128,7 +1128,7 @@ void KeepassMainWindow::hideEvent(QHideEvent* event){
|
||||||
if (config->lockOnMinimize() && !IsLocked && FileOpen)
|
if (config->lockOnMinimize() && !IsLocked && FileOpen)
|
||||||
OnUnLockWorkspace();
|
OnUnLockWorkspace();
|
||||||
if (config->showSysTrayIcon() && config->minimizeTray()){
|
if (config->showSysTrayIcon() && config->minimizeTray()){
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_OS_WIN32
|
||||||
QTimer::singleShot(100, this, SLOT(hide()));
|
QTimer::singleShot(100, this, SLOT(hide()));
|
||||||
#else
|
#else
|
||||||
hide();
|
hide();
|
||||||
|
@ -1143,7 +1143,7 @@ void KeepassMainWindow::hideEvent(QHideEvent* event){
|
||||||
|
|
||||||
void KeepassMainWindow::showEvent(QShowEvent* event){
|
void KeepassMainWindow::showEvent(QShowEvent* event){
|
||||||
if (IsLocked && !InUnLock && event->spontaneous()){
|
if (IsLocked && !InUnLock && event->spontaneous()){
|
||||||
#ifndef Q_WS_MAC
|
#ifndef Q_OS_MAC
|
||||||
showNormal(); // workaround for some graphic glitches
|
showNormal(); // workaround for some graphic glitches
|
||||||
#endif
|
#endif
|
||||||
OnUnLockWorkspace();
|
OnUnLockWorkspace();
|
||||||
|
@ -1171,7 +1171,7 @@ void KeepassMainWindow::OnExtrasSettings(){
|
||||||
EntryView->setAlternatingRowColors(config->alternatingRowColors());
|
EntryView->setAlternatingRowColors(config->alternatingRowColors());
|
||||||
SysTray->setVisible(config->showSysTrayIcon());
|
SysTray->setVisible(config->showSysTrayIcon());
|
||||||
menuBookmarks->menuAction()->setVisible(config->featureBookmarks());
|
menuBookmarks->menuAction()->setVisible(config->featureBookmarks());
|
||||||
#ifndef Q_WS_MAC
|
#ifndef Q_OS_MAC
|
||||||
if (config->alwaysOnTop() != oldAlwaysOnTop) {
|
if (config->alwaysOnTop() != oldAlwaysOnTop) {
|
||||||
if (config->alwaysOnTop())
|
if (config->alwaysOnTop())
|
||||||
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
||||||
|
@ -1271,7 +1271,7 @@ void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason rea
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_OS_WIN32
|
||||||
QTimer::singleShot(100, this, SLOT(restoreWindow()));
|
QTimer::singleShot(100, this, SLOT(restoreWindow()));
|
||||||
#else
|
#else
|
||||||
restoreWindow();
|
restoreWindow();
|
||||||
|
@ -1281,7 +1281,7 @@ void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason rea
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassMainWindow::restoreWindow(){
|
void KeepassMainWindow::restoreWindow(){
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_OS_WIN32
|
||||||
if (windowState() & Qt::WindowMaximized)
|
if (windowState() & Qt::WindowMaximized)
|
||||||
showMaximized();
|
showMaximized();
|
||||||
else
|
else
|
||||||
|
@ -1339,7 +1339,7 @@ void KeepassMainWindow::OnUnLockWorkspace(){
|
||||||
if(IsLocked){
|
if(IsLocked){
|
||||||
if (InUnLock) return;
|
if (InUnLock) return;
|
||||||
InUnLock = true;
|
InUnLock = true;
|
||||||
#if defined(GLOBAL_AUTOTYPE) && defined(Q_WS_MAC)
|
#if defined(GLOBAL_AUTOTYPE) && defined(Q_OS_MAC)
|
||||||
// show in case minimized, especially in another Space
|
// show in case minimized, especially in another Space
|
||||||
// only needed if invoked from global autotype
|
// only needed if invoked from global autotype
|
||||||
show();
|
show();
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
class KeepassMainWindow : public QMainWindow, private Ui_MainWindow{
|
class KeepassMainWindow : public QMainWindow, private Ui_MainWindow{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
KeepassMainWindow (const QString& ArgFile,bool ArgMin,bool ArgLock,QWidget *parent=0, Qt::WFlags flags=0);
|
KeepassMainWindow (const QString& ArgFile,bool ArgMin,bool ArgLock,QWidget *parent=0, Qt::WindowFlags flags=0);
|
||||||
IDatabase* db;
|
IDatabase* db;
|
||||||
inline bool isLocked() { return IsLocked; };
|
inline bool isLocked() { return IsLocked; };
|
||||||
inline bool isOpened() { return FileOpen; };
|
inline bool isOpened() { return FileOpen; };
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
CONFIG = qt uic resources thread stl warn_on
|
CONFIG = qt uic resources thread stl warn_on
|
||||||
QT += xml
|
QT += xml
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
*-g++ : QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare
|
*-g++ : QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare
|
||||||
|
|
||||||
DEPENDPATH += crypto dialogs export forms import lib translations res
|
DEPENDPATH += crypto dialogs export forms import lib translations res
|
||||||
|
|
Loading…
Reference in New Issue