mirror of
https://github.com/chris2511/xca.git
synced 2026-09-14 11:06:19 +05:00
Workaround for Mac OSX database drop on XCA
OSX EventDispatcher bug for drag and drop events https://bugreports.qt.io/browse/QTBUG-29701
This commit is contained in:
parent
1138dad902
commit
d26f71bf63
@ -23,6 +23,7 @@
|
||||
#include <QtGui/QTextBrowser>
|
||||
#include <QtGui/QStatusBar>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QInputDialog>
|
||||
|
||||
#include "lib/exception.h"
|
||||
@ -133,8 +134,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
dn_nid = read_nidlist("dn.txt");
|
||||
aia_nid = read_nidlist("aia.txt");
|
||||
|
||||
connect(this, SIGNAL(newURLs(QStringList &)),
|
||||
this, SLOT(openURLs(QStringList &)));
|
||||
setAcceptDrops(true);
|
||||
|
||||
searchEdit = new QLineEdit();
|
||||
@ -167,22 +166,29 @@ void MainWindow::dropEvent(QDropEvent *event)
|
||||
QString s = u.toLocalFile();
|
||||
files << s;
|
||||
}
|
||||
emit newURLs(files);
|
||||
openURLs(files);
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
void MainWindow::openURLs(QStringList &files)
|
||||
{
|
||||
urlsToOpen = files;
|
||||
QTimer::singleShot(100, this, SLOT(openURLs()));
|
||||
}
|
||||
|
||||
void MainWindow::openURLs()
|
||||
{
|
||||
QStringList failed;
|
||||
QString s;
|
||||
ImportMulti *dlgi = new ImportMulti(this);
|
||||
|
||||
foreach(s, files) {
|
||||
foreach(s, urlsToOpen) {
|
||||
pki_multi *pki = probeAnything(s);
|
||||
if (pki && !pki->count())
|
||||
failed << s;
|
||||
dlgi->addItem(pki);
|
||||
}
|
||||
urlsToOpen.clear();
|
||||
dlgi->execute(1, failed);
|
||||
delete dlgi;
|
||||
}
|
||||
|
||||
@ -81,6 +81,7 @@ class MainWindow: public QMainWindow, public Ui::MainWindow
|
||||
void update_history_menu();
|
||||
void set_geometry(char *p, db_header_t *head);
|
||||
QLineEdit *searchEdit;
|
||||
QStringList urlsToOpen;
|
||||
|
||||
protected:
|
||||
void init_images();
|
||||
@ -155,11 +156,9 @@ class MainWindow: public QMainWindow, public Ui::MainWindow
|
||||
void pastePem();
|
||||
void changeDbPass();
|
||||
void openURLs(QStringList &files);
|
||||
void openURLs();
|
||||
void changeEvent(QEvent *event);
|
||||
|
||||
signals:
|
||||
void newURLs(QStringList &);
|
||||
|
||||
private slots:
|
||||
void setOptions();
|
||||
void manageToken();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user