summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrédéric Brière <fbriere@fbriere.net>2016-10-04 14:39:37 -0400
committerFrédéric Brière <fbriere@fbriere.net>2016-10-04 14:39:37 -0400
commit5be7b2c552c4b904936db8ad8d5a34415b2a5512 (patch)
tree072d1a54a814d188e0e893f5c38657511b97f9a2 /src
parenta06681c29a66b7213eef0261d689230ee7515e5e (diff)
downloadtwinkle-5be7b2c552c4b904936db8ad8d5a34415b2a5512.tar
twinkle-5be7b2c552c4b904936db8ad8d5a34415b2a5512.tar.gz
twinkle-5be7b2c552c4b904936db8ad8d5a34415b2a5512.tar.lz
twinkle-5be7b2c552c4b904936db8ad8d5a34415b2a5512.tar.xz
twinkle-5be7b2c552c4b904936db8ad8d5a34415b2a5512.zip
Invoke "ask user to refer" from within the GUI thread
Fixes #74
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui.cpp25
-rw-r--r--src/gui/gui.h4
2 files changed, 23 insertions, 6 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 160f982..bee6b0a 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -744,6 +744,7 @@ t_gui::t_gui(t_phone *_phone) : t_userintf(_phone), timerUpdateMessageSessions(N
qRegisterMetaType<t_register_type>("t_register_type");
qRegisterMetaType<t_transfer_type>("t_transfer_type");
qRegisterMetaType<t_cf_type>("t_cf_type");
+ qRegisterMetaType<string>("string");
qRegisterMetaType<std::list<std::string>>("std::list<std::string>");
mainWindow = new MphoneForm;
@@ -2289,16 +2290,17 @@ bool t_gui::do_cb_ask_user_to_redirect_request(t_user *user_config, const t_url
return permission;
}
-void t_gui::cb_ask_user_to_refer(t_user *user_config, const t_url &refer_to_uri,
+void t_gui::do_cb_ask_user_to_refer(t_user *user_config, const string &refer_to_uri_str,
const string &refer_to_display,
- const t_url &referred_by_uri,
+ const string &referred_by_uri_str,
const string &referred_by_display)
{
+ t_url refer_to_uri(refer_to_uri_str);
+ t_url referred_by_uri(referred_by_uri_str);
+
QString s;
QString title;
- lock();
-
title = PRODUCT_NAME;
title.append(" - ").append(qApp->translate("GUI", "Transferring call"));
@@ -2333,8 +2335,19 @@ void t_gui::cb_ask_user_to_refer(t_user *user_config, const t_url &refer_to_uri,
ReferPermissionDialog *dialog = new ReferPermissionDialog(mainWindow, title, s);
// Do not report to MEMMAN as Qt will auto destruct this dialog on close.
dialog->show();
-
- unlock();
+}
+
+void t_gui::cb_ask_user_to_refer(t_user *user_config, const t_url &refer_to_uri,
+ const string &refer_to_display,
+ const t_url &referred_by_uri,
+ const string &referred_by_display)
+{
+ QMetaObject::invokeMethod(this, "do_cb_ask_user_to_refer",
+ Q_ARG(t_user*, user_config),
+ Q_ARG(const string&, refer_to_uri.encode()),
+ Q_ARG(const string&, refer_to_display),
+ Q_ARG(const string&, referred_by_uri.encode()),
+ Q_ARG(const string&, referred_by_display));
}
void t_gui::cb_show_msg(const string &msg, t_msg_priority prio) {
diff --git a/src/gui/gui.h b/src/gui/gui.h
index db27ad0..d0cada0 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -436,6 +436,10 @@ private slots:
const string &display, t_method method);
bool do_cb_ask_credentials(t_user *user_config, const string &realm, string &username,
string &password);
+ void do_cb_ask_user_to_refer(t_user *user_config, const string &refer_to_uri_str,
+ const string &refer_to_display,
+ const string &referred_by_uri_str,
+ const string &referred_by_display);
void do_cb_register_inprog(t_user *user_config, t_register_type register_type);
};