Use a signal to connect to a slot in main window.
Coding style fixes. http://gitorious.org/keepassx/keepassx/merge_requests/10
This commit is contained in:
committed by
Felix Geyer
parent
679398be00
commit
d445bf1ecd
@@ -17,12 +17,10 @@
|
||||
|
||||
#include "KeePassApp.h"
|
||||
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QFileOpenEvent>
|
||||
|
||||
KeePassApp::KeePassApp(int &argc, char **argv) :
|
||||
QApplication(argc, argv),
|
||||
mainWindow(NULL)
|
||||
KeePassApp::KeePassApp(int& argc, char** argv)
|
||||
: QApplication(argc, argv)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -30,18 +28,13 @@ KeePassApp::~KeePassApp()
|
||||
{
|
||||
}
|
||||
|
||||
void KeePassApp::setMainWindow(MainWindow *mainWindow)
|
||||
{
|
||||
this->mainWindow = mainWindow;
|
||||
}
|
||||
|
||||
bool KeePassApp::event(QEvent *event)
|
||||
{
|
||||
// Handle Apple QFileOpenEvent from finder (double click on .kdbx file)
|
||||
if (event->type() == QEvent::FileOpen && mainWindow) {
|
||||
mainWindow->openDatabase(static_cast<QFileOpenEvent*>(event)->file(), QString(), QString());
|
||||
return true;
|
||||
}
|
||||
// Handle Apple QFileOpenEvent from finder (double click on .kdbx file)
|
||||
if (event->type() == QEvent::FileOpen) {
|
||||
Q_EMIT openDatabase(static_cast<QFileOpenEvent*>(event)->file());
|
||||
return true;
|
||||
}
|
||||
|
||||
return (QApplication::event(event));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
|
||||
class KeePassApp : public QApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
MainWindow *mainWindow;
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KeePassApp(int &argc, char **argv);
|
||||
~KeePassApp();
|
||||
KeePassApp(int& argc, char** argv);
|
||||
~KeePassApp();
|
||||
|
||||
void setMainWindow(MainWindow *mainWindow);
|
||||
bool event(QEvent *event);
|
||||
};
|
||||
bool event(QEvent *event);
|
||||
|
||||
Q_SIGNALS:
|
||||
void openDatabase(const QString& filename);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user