Index: libs/libmythui/mythdialogbox.h =================================================================== --- libs/libmythui/mythdialogbox.h (revision 19667) +++ libs/libmythui/mythdialogbox.h (working copy) @@ -219,8 +219,8 @@ void slotUpdateList(void); }; -MPUBLIC void ShowOkPopup(const QString &message, QObject *parent = NULL, - const char *slot = NULL, bool showCancel = false); +MPUBLIC MythConfirmationDialog *ShowOkPopup(const QString &message, QObject *parent = NULL, + const char *slot = NULL, bool showCancel = false); Q_DECLARE_METATYPE(const char*) Index: libs/libmythui/mythdialogbox.cpp =================================================================== --- libs/libmythui/mythdialogbox.cpp (revision 19667) +++ libs/libmythui/mythdialogbox.cpp (working copy) @@ -275,8 +275,8 @@ /** * Non-blocking version of MythPopupBox::showOkPopup() */ -void ShowOkPopup(const QString &message, QObject *parent, - const char *slot, bool showCancel) +MythConfirmationDialog *ShowOkPopup(const QString &message, QObject *parent, + const char *slot, bool showCancel) { QString LOC = "ShowOkPopup('" + message + "') - "; MythConfirmationDialog *pop; @@ -292,14 +292,14 @@ else { VERBOSE(VB_IMPORTANT, LOC + "no main window?"); - return; + return NULL; } if (!stk) { VERBOSE(VB_IMPORTANT, LOC + "no popup stack?\n" "Is there a MythThemeBase?"); - return; + return NULL; } } @@ -313,8 +313,11 @@ else { delete pop; + pop = NULL; VERBOSE(VB_IMPORTANT, LOC + "Couldn't Create() Dialog"); } + + return pop; } ///////////////////////////////////////////////////////////////// Index: libs/libmyth/mythcontext.h =================================================================== --- libs/libmyth/mythcontext.h (revision 19667) +++ libs/libmyth/mythcontext.h (working copy) @@ -192,6 +192,9 @@ void sendPlaybackStart(void); void sendPlaybackEnd(void); + private slots: + void popupClosed(void); + private: void connected(MythSocket *sock); void connectionClosed(MythSocket *sock); @@ -203,6 +206,7 @@ QMutex locationLock; QStringList currentLocation; + }; /// This global variable contains the MythContext instance for the application Index: libs/libmyth/mythcontext.cpp =================================================================== --- libs/libmyth/mythcontext.cpp (revision 19667) +++ libs/libmyth/mythcontext.cpp (working copy) @@ -116,6 +116,7 @@ bool disablelibrarypopup; + MythConfirmationDialog *popup; MythPluginManager *pluginmanager; int m_logenable, m_logmaxcount, m_logprintlevel; @@ -213,6 +214,7 @@ mainWindow(NULL), serverSock(NULL), eventSock(NULL), disablelibrarypopup(false), + popup(NULL), pluginmanager(NULL), m_logenable(-1), m_logmaxcount(-1), m_logprintlevel(-1), m_database(GetMythDB()), m_ui(NULL) @@ -1356,20 +1358,25 @@ manageLock = true; d->serverSockLock.unlock(); } - // HACK. TODO: Remove when all old-style widgets are gone - if (d->mainWindow->currentWidget()) - MythPopupBox::showOkPopup(d->mainWindow, - "connection failure", - tr("Could not connect to the " - "master backend server -- is " - "it running? Is the IP " - "address set for it in the " - "setup program correct?")); - else - ShowOkPopup(tr("Could not connect to the master" - " backend server -- is it running?" - " Is the IP address set for it in the " - "setup program correct?")); + // HACK. TODO: Remove when all old-style widgets are gone + if (d->mainWindow->currentWidget()) + MythPopupBox::showOkPopup(d->mainWindow, + "connection failure", + tr("Could not connect to the " + "master backend server -- is " + "it running? Is the IP " + "address set for it in the " + "setup program correct?")); + else + { + if (!d->popup) + d->popup = ShowOkPopup( + tr("Could not connect to the master" + " backend server -- is it running? " + "Is the IP address set for it in the " + "setup program correct?"), + this, SLOT(popupClosed())); + } if (manageLock) d->serverSockLock.lock(); } @@ -1435,7 +1442,14 @@ eventSock->Unlock(); } + + if (d->popup) + { + d->popup->Close(); + d->popup = NULL; + } } + return serverSock; } @@ -2202,4 +2216,10 @@ dispatchNow(me); } +void MythContext::popupClosed(void) +{ + if (d) + d->popup = NULL; +} + /* vim: set expandtab tabstop=4 shiftwidth=4: */