Show confirmation dialog when Opening a temp file copy (warn user about lost edits)
This commit is contained in:
parent
72925d5db3
commit
1ce86f8a73
@ -272,6 +272,8 @@ void rwSettings(bool writing)
|
||||
Bool, false);
|
||||
SETTING_RW(prefs.showTrayIcon, "/Recoll/prefs/showTrayIcon", Bool, false);
|
||||
SETTING_RW(prefs.closeToTray, "/Recoll/prefs/closeToTray", Bool, false);
|
||||
SETTING_RW(prefs.showTempFileWarning, "Recoll/prefs/showTempFileWarning",
|
||||
Int, -1);
|
||||
|
||||
if (g_dynconf == 0) {
|
||||
// Happens
|
||||
|
||||
@ -136,6 +136,8 @@ class PrefsPack {
|
||||
bool showTrayIcon;
|
||||
bool closeToTray;
|
||||
|
||||
int showTempFileWarning;
|
||||
|
||||
// Advanced search window clause list state
|
||||
vector<int> advSearchClauses;
|
||||
|
||||
|
||||
@ -22,6 +22,8 @@
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "qxtconfirmationmessage.h"
|
||||
|
||||
#include "debuglog.h"
|
||||
#include "fileudi.h"
|
||||
#include "execmd.h"
|
||||
@ -288,8 +290,9 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
|
||||
}
|
||||
}
|
||||
|
||||
bool enterHistory = false;
|
||||
bool istempfile = false;
|
||||
|
||||
|
||||
LOGDEB(("RclMain::startNV: groksipath %d wantsf %d wantsparentf %d\n",
|
||||
groksipath, wantsfile, wantsparentfile));
|
||||
|
||||
@ -307,7 +310,8 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
|
||||
"temporary file"));
|
||||
return;
|
||||
}
|
||||
istempfile = true;
|
||||
enterHistory = true;
|
||||
istempfile = true;
|
||||
rememberTempFile(temp);
|
||||
fn = temp->filename();
|
||||
url = path_pathtofileurl(fn);
|
||||
@ -333,12 +337,26 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
|
||||
}
|
||||
}
|
||||
if (temp) {
|
||||
istempfile = true;
|
||||
rememberTempFile(temp);
|
||||
fn = temp->filename();
|
||||
url = path_pathtofileurl(fn);
|
||||
}
|
||||
}
|
||||
|
||||
if (istempfile) {
|
||||
QxtConfirmationMessage confirm(
|
||||
QMessageBox::Warning,
|
||||
"Recoll",
|
||||
tr("Opening a temporary copy. Edits will be lost if you don't save"
|
||||
"<br/>them to a permanent location."),
|
||||
"Do not show this warning next time "
|
||||
"(open GUI preferences to restore)");
|
||||
confirm.setSettingsPath("Recoll/prefs");
|
||||
confirm.setOverrideSettingsKey("showTempFileWarning");
|
||||
confirm.exec();
|
||||
}
|
||||
|
||||
// If we are not called with a page number (which would happen for a call
|
||||
// from the snippets window), see if we can compute a page number anyway.
|
||||
if (pagenum == -1) {
|
||||
@ -379,10 +397,10 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
|
||||
it != doc.meta.end(); it++) {
|
||||
subs[it->first] = it->second;
|
||||
}
|
||||
execViewer(subs, istempfile, execpath, lcmd, cmd, doc);
|
||||
execViewer(subs, enterHistory, execpath, lcmd, cmd, doc);
|
||||
}
|
||||
|
||||
void RclMain::execViewer(const map<string, string>& subs, bool istempfile,
|
||||
void RclMain::execViewer(const map<string, string>& subs, bool enterHistory,
|
||||
const string& execpath,
|
||||
const vector<string>& _lcmd, const string& cmd,
|
||||
Rcl::Doc doc)
|
||||
@ -412,7 +430,7 @@ void RclMain::execViewer(const map<string, string>& subs, bool istempfile,
|
||||
stb->showMessage(msg, 10000);
|
||||
}
|
||||
|
||||
if (!istempfile)
|
||||
if (!enterHistory)
|
||||
historyEnterDoc(g_dynconf, doc.meta[Rcl::Doc::keyudi]);
|
||||
|
||||
// Do the zeitgeist thing
|
||||
|
||||
@ -249,6 +249,8 @@ void RclMain::showUIPrefs()
|
||||
} else {
|
||||
// Close and reopen, in hope that makes us visible...
|
||||
uiprefs->close();
|
||||
rwSettings(false);
|
||||
uiprefs->setFromPrefs();
|
||||
}
|
||||
uiprefs->show();
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ private:
|
||||
virtual void setupResTB(bool combo);
|
||||
virtual void previewPrevOrNextInTab(Preview *, int sid, int docnum,
|
||||
bool next);
|
||||
virtual void execViewer(const map<string, string>& subs, bool istempfile,
|
||||
virtual void execViewer(const map<string, string>& subs, bool enterHistory,
|
||||
const string& execpath, const vector<string>& lcmd,
|
||||
const string& cmd, Rcl::Doc doc);
|
||||
virtual void setStemLang(const QString& lang);
|
||||
|
||||
@ -22,11 +22,11 @@ HEADERS += \
|
||||
confgui/confgui.h \
|
||||
confgui/confguiindex.h \
|
||||
crontool.h \
|
||||
editdialog.h \
|
||||
widgets/editdialog.h \
|
||||
firstidx.h \
|
||||
fragbuts.h \
|
||||
idxsched.h \
|
||||
listdialog.h \
|
||||
widgets/listdialog.h \
|
||||
preview_w.h \
|
||||
preview_load.h \
|
||||
preview_plaintorich.h \
|
||||
@ -78,15 +78,16 @@ SOURCES += \
|
||||
systray.cpp \
|
||||
uiprefs_w.cpp \
|
||||
viewaction_w.cpp \
|
||||
widgets/qxtconfirmationmessage.cpp \
|
||||
xmltosd.cpp
|
||||
|
||||
FORMS = \
|
||||
advsearch.ui \
|
||||
crontool.ui \
|
||||
editdialog.ui \
|
||||
widgets/editdialog.ui \
|
||||
firstidx.ui \
|
||||
idxsched.ui \
|
||||
listdialog.ui \
|
||||
widgets/listdialog.ui \
|
||||
ptrans.ui \
|
||||
rclmain.ui \
|
||||
restable.ui \
|
||||
@ -102,7 +103,7 @@ RESOURCES = recoll.qrc
|
||||
|
||||
INCLUDEPATH += ../common ../index ../internfile ../query ../unac \
|
||||
../utils ../aspell ../rcldb ../qtgui ../xaposix \
|
||||
confgui
|
||||
confgui widgets
|
||||
windows {
|
||||
RC_FILE = recoll.rc
|
||||
contains(QMAKE_CC, gcc){
|
||||
|
||||
@ -21,14 +21,12 @@ HEADERS += \
|
||||
confgui/confgui.h \
|
||||
confgui/confguiindex.h \
|
||||
crontool.h \
|
||||
editdialog.h \
|
||||
firstidx.h \
|
||||
fragbuts.h \
|
||||
idxsched.h \
|
||||
listdialog.h \
|
||||
preview_w.h \
|
||||
preview_load.h \
|
||||
preview_plaintorich.h \
|
||||
preview_w.h \
|
||||
ptrans_w.h \
|
||||
rclhelp.h \
|
||||
rclmain_w.h \
|
||||
@ -43,6 +41,9 @@ HEADERS += \
|
||||
systray.h \
|
||||
uiprefs_w.h \
|
||||
viewaction_w.h \
|
||||
widgets/editdialog.h \
|
||||
widgets/listdialog.h \
|
||||
widgets/qxtconfirmationmessage.h
|
||||
|
||||
SOURCES += \
|
||||
advsearch_w.cpp \
|
||||
@ -54,20 +55,20 @@ SOURCES += \
|
||||
guiutils.cpp \
|
||||
main.cpp \
|
||||
multisave.cpp \
|
||||
preview_w.cpp \
|
||||
preview_load.cpp \
|
||||
preview_plaintorich.cpp \
|
||||
preview_w.cpp \
|
||||
ptrans_w.cpp \
|
||||
rclhelp.cpp \
|
||||
rclmain_w.cpp \
|
||||
rclm_idx.cpp \
|
||||
rclm_preview.cpp \
|
||||
rclm_saveload.cpp \
|
||||
rclm_view.cpp \
|
||||
rclm_wins.cpp \
|
||||
rclmain_w.cpp \
|
||||
rclzg.cpp \
|
||||
respopup.cpp \
|
||||
reslist.cpp \
|
||||
respopup.cpp \
|
||||
restable.cpp \
|
||||
rtitool.cpp \
|
||||
searchclause_w.cpp \
|
||||
@ -77,15 +78,16 @@ SOURCES += \
|
||||
systray.cpp \
|
||||
uiprefs_w.cpp \
|
||||
viewaction_w.cpp \
|
||||
widgets/qxtconfirmationmessage.cpp \
|
||||
xmltosd.cpp
|
||||
|
||||
FORMS = \
|
||||
advsearch.ui \
|
||||
crontool.ui \
|
||||
editdialog.ui \
|
||||
widgets/editdialog.ui \
|
||||
firstidx.ui \
|
||||
idxsched.ui \
|
||||
listdialog.ui \
|
||||
widgets/listdialog.ui \
|
||||
ptrans.ui \
|
||||
rclmain.ui \
|
||||
restable.ui \
|
||||
@ -118,7 +120,8 @@ unix {
|
||||
INCLUDEPATH += ../common @srcdir@/../common @srcdir@/../index \
|
||||
@srcdir@/../internfile @srcdir@/../query @srcdir@/../unac \
|
||||
@srcdir@/../utils @srcdir@/../aspell @srcdir@/../rcldb \
|
||||
@srcdir@/../qtgui @srcdir@/../xaposix @srcdir@/confgui
|
||||
@srcdir@/../qtgui @srcdir@/../xaposix @srcdir@/confgui \
|
||||
@srcdir@/widgets
|
||||
DEPENDPATH += $$INCLUDEPATH
|
||||
}
|
||||
|
||||
|
||||
@ -314,6 +314,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showTempFileWarningCB">
|
||||
<property name="text">
|
||||
<string>Show warning when opening temporary file.</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer4">
|
||||
<property name="orientation">
|
||||
|
||||
@ -139,6 +139,7 @@ void UIPrefsDialog::setFromPrefs()
|
||||
keepSortCB->setChecked(prefs.keepSort);
|
||||
showTrayIconCB->setChecked(prefs.showTrayIcon);
|
||||
closeToTrayCB->setChecked(prefs.closeToTray);
|
||||
showTempFileWarningCB->setChecked(prefs.showTempFileWarning == -1);
|
||||
previewHtmlCB->setChecked(prefs.previewHtml);
|
||||
switch (prefs.previewPlainPre) {
|
||||
case PrefsPack::PP_BR:
|
||||
@ -322,6 +323,8 @@ void UIPrefsDialog::accept()
|
||||
prefs.keepSort = keepSortCB->isChecked();
|
||||
prefs.showTrayIcon = showTrayIconCB->isChecked();
|
||||
prefs.closeToTray = closeToTrayCB->isChecked();
|
||||
prefs.showTempFileWarning = showTempFileWarningCB->isChecked() ?
|
||||
-1 : 1024;
|
||||
prefs.previewHtml = previewHtmlCB->isChecked();
|
||||
|
||||
if (plainBRRB->isChecked()) {
|
||||
@ -371,6 +374,7 @@ void UIPrefsDialog::editParaFormat()
|
||||
if (result == QDialog::Accepted)
|
||||
paraFormat = dialog.plainTextEdit->toPlainText();
|
||||
}
|
||||
|
||||
void UIPrefsDialog::editHeaderText()
|
||||
{
|
||||
EditDialog dialog(this);
|
||||
|
||||
@ -45,6 +45,7 @@ public:
|
||||
QString synFile;
|
||||
|
||||
virtual void init();
|
||||
void setFromPrefs();
|
||||
|
||||
public slots:
|
||||
virtual void showFontDialog();
|
||||
@ -67,7 +68,7 @@ public slots:
|
||||
virtual void editHeaderText();
|
||||
virtual void extradDbSelectChanged();
|
||||
virtual void extraDbEditPtrans();
|
||||
|
||||
|
||||
signals:
|
||||
void uiprefsDone();
|
||||
|
||||
@ -79,7 +80,6 @@ private:
|
||||
// Locally stored data (pending ok/cancel)
|
||||
QString paraFormat;
|
||||
QString headerText;
|
||||
void setFromPrefs();
|
||||
ViewAction *m_viewAction;
|
||||
RclMain *m_mainWindow;
|
||||
};
|
||||
|
||||
438
src/qtgui/widgets/qxtconfirmationmessage.cpp
Normal file
438
src/qtgui/widgets/qxtconfirmationmessage.cpp
Normal file
@ -0,0 +1,438 @@
|
||||
#include "qxtconfirmationmessage.h"
|
||||
/****************************************************************************
|
||||
** Copyright (c) 2006 - 2011, the LibQxt project.
|
||||
** See the Qxt AUTHORS file for a list of authors and copyright holders.
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** * Neither the name of the LibQxt project nor the
|
||||
** names of its contributors may be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
** <http://libqxt.org> <foundation@libqxt.org>
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QGridLayout>
|
||||
#include <QCheckBox>
|
||||
|
||||
static const QLatin1String DEFAULT_ORGANIZATION("QxtWidgets");
|
||||
static const QLatin1String DEFAULT_APPLICATION("QxtConfirmationMessage");
|
||||
|
||||
class QxtConfirmationMessagePrivate : public QxtPrivate<QxtConfirmationMessage>
|
||||
{
|
||||
public:
|
||||
QXT_DECLARE_PUBLIC(QxtConfirmationMessage)
|
||||
void init(const QString& message = QString());
|
||||
|
||||
QString key() const;
|
||||
QString applicationName() const;
|
||||
QString organizationName() const;
|
||||
|
||||
int showAgain();
|
||||
void doNotShowAgain(int result);
|
||||
void reset();
|
||||
|
||||
bool remember;
|
||||
QCheckBox* confirm;
|
||||
QString overrideApp;
|
||||
QString overrideKey;
|
||||
QString overrideOrg;
|
||||
|
||||
static QString path;
|
||||
static QSettings::Scope scope;
|
||||
static QSettings::Format format;
|
||||
};
|
||||
|
||||
QString QxtConfirmationMessagePrivate::path;
|
||||
QSettings::Scope QxtConfirmationMessagePrivate::scope = QSettings::UserScope;
|
||||
QSettings::Format QxtConfirmationMessagePrivate::format = QSettings::NativeFormat;
|
||||
|
||||
void QxtConfirmationMessagePrivate::init(const QString& message)
|
||||
{
|
||||
remember = false;
|
||||
confirm = new QCheckBox(&qxt_p());
|
||||
if (!message.isNull())
|
||||
confirm->setText(message);
|
||||
else
|
||||
confirm->setText(QxtConfirmationMessage::tr("Do not show again."));
|
||||
|
||||
QGridLayout* grid = qobject_cast<QGridLayout*>(qxt_p().layout());
|
||||
QDialogButtonBox* buttons = qxt_p().findChild<QDialogButtonBox*>();
|
||||
if (grid && buttons)
|
||||
{
|
||||
const int idx = grid->indexOf(buttons);
|
||||
int row, column, rowSpan, columnSpan = 0;
|
||||
grid->getItemPosition(idx, &row, &column, &rowSpan, &columnSpan);
|
||||
QLayoutItem* buttonsItem = grid->takeAt(idx);
|
||||
grid->addWidget(confirm, row, column, rowSpan, columnSpan, Qt::AlignLeft | Qt::AlignTop);
|
||||
grid->addItem(buttonsItem, ++row, column, rowSpan, columnSpan);
|
||||
}
|
||||
}
|
||||
|
||||
QString QxtConfirmationMessagePrivate::key() const
|
||||
{
|
||||
QString value = overrideKey;
|
||||
if (value.isEmpty())
|
||||
{
|
||||
const QString all = qxt_p().windowTitle() + qxt_p().text() + qxt_p().informativeText();
|
||||
const QByteArray data = all.toLocal8Bit();
|
||||
value = QString::number(qChecksum(data.constData(), data.length()));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
QString QxtConfirmationMessagePrivate::applicationName() const
|
||||
{
|
||||
QString name = overrideApp;
|
||||
if (name.isEmpty())
|
||||
name = QCoreApplication::applicationName();
|
||||
if (name.isEmpty())
|
||||
name = DEFAULT_APPLICATION;
|
||||
return name;
|
||||
}
|
||||
|
||||
QString QxtConfirmationMessagePrivate::organizationName() const
|
||||
{
|
||||
QString name = overrideOrg;
|
||||
if (name.isEmpty())
|
||||
name = QCoreApplication::organizationName();
|
||||
if (name.isEmpty())
|
||||
name = DEFAULT_ORGANIZATION;
|
||||
return name;
|
||||
}
|
||||
|
||||
int QxtConfirmationMessagePrivate::showAgain()
|
||||
{
|
||||
QSettings settings(format, scope, organizationName(), applicationName());
|
||||
if (!path.isEmpty())
|
||||
settings.beginGroup(path);
|
||||
return settings.value(key(), -1).toInt();
|
||||
}
|
||||
|
||||
void QxtConfirmationMessagePrivate::doNotShowAgain(int result)
|
||||
{
|
||||
QSettings settings(format, scope, organizationName(), applicationName());
|
||||
if (!path.isEmpty())
|
||||
settings.beginGroup(path);
|
||||
settings.setValue(key(), result);
|
||||
}
|
||||
|
||||
void QxtConfirmationMessagePrivate::reset()
|
||||
{
|
||||
QSettings settings(format, scope, organizationName(), applicationName());
|
||||
if (!path.isEmpty())
|
||||
settings.beginGroup(path);
|
||||
settings.remove(key());
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QxtConfirmationMessage
|
||||
\inmodule QxtWidgets
|
||||
\brief The QxtConfirmationMessage class provides a confirmation message.
|
||||
|
||||
QxtConfirmationMessage is a confirmation message with checkable
|
||||
\bold {"Do not show again."} option. A checked and accepted confirmation
|
||||
message is no more shown until reseted.
|
||||
|
||||
Example usage:
|
||||
\code
|
||||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
static const QString text(tr("Are you sure you want to quit?"));
|
||||
if (QxtConfirmationMessage::confirm(this, tr("Confirm"), text) == QMessageBox::No)
|
||||
event->ignore();
|
||||
}
|
||||
\endcode
|
||||
|
||||
\image qxtconfirmationmessage.png "QxtConfirmationMessage in action."
|
||||
|
||||
\bold {Note:} QCoreApplication::organizationName and QCoreApplication::applicationName
|
||||
are used for storing settings. In case these properties are empty, \bold "QxtWidgets" and
|
||||
\bold "QxtConfirmationMessage" are used, respectively.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a new QxtConfirmationMessage with \a parent.
|
||||
*/
|
||||
QxtConfirmationMessage::QxtConfirmationMessage(QWidget* parent)
|
||||
: QMessageBox(parent)
|
||||
{
|
||||
QXT_INIT_PRIVATE(QxtConfirmationMessage);
|
||||
qxt_d().init();
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a new QxtConfirmationMessage with \a icon, \a title, \a text, \a confirmation, \a buttons, \a parent and \a flags.
|
||||
*/
|
||||
QxtConfirmationMessage::QxtConfirmationMessage(QMessageBox::Icon icon, const QString& title, const QString& text, const QString& confirmation,
|
||||
QMessageBox::StandardButtons buttons, QWidget* parent, Qt::WindowFlags flags)
|
||||
: QMessageBox(icon, title, text, buttons, parent, flags)
|
||||
{
|
||||
QXT_INIT_PRIVATE(QxtConfirmationMessage);
|
||||
qxt_d().init(confirmation);
|
||||
}
|
||||
|
||||
/*!
|
||||
Destructs the confirmation message.
|
||||
*/
|
||||
QxtConfirmationMessage::~QxtConfirmationMessage()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Opens an confirmation message box with the specified \a title, \a text and \a confirmation.
|
||||
The standard \a buttons are added to the message box. \a defaultButton specifies
|
||||
the button used when Enter is pressed. \a defaultButton must refer to a button that
|
||||
was given in \a buttons. If \a defaultButton is QMessageBox::NoButton, QMessageBox
|
||||
chooses a suitable default automatically.
|
||||
|
||||
Returns the identity of the standard button that was clicked.
|
||||
If Esc was pressed instead, the escape button is returned.
|
||||
|
||||
If \a parent is \c 0, the message box is an application modal dialog box.
|
||||
If \a parent is a widget, the message box is window modal relative to \a parent.
|
||||
*/
|
||||
QMessageBox::StandardButton QxtConfirmationMessage::confirm(QWidget* parent,
|
||||
const QString& title, const QString& text, const QString& confirmation,
|
||||
QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
|
||||
{
|
||||
QxtConfirmationMessage msgBox(QMessageBox::NoIcon, title, text, confirmation, QMessageBox::NoButton, parent);
|
||||
QDialogButtonBox* buttonBox = msgBox.findChild<QDialogButtonBox*>();
|
||||
Q_ASSERT(buttonBox != 0);
|
||||
|
||||
uint mask = QMessageBox::FirstButton;
|
||||
while (mask <= QMessageBox::LastButton)
|
||||
{
|
||||
uint sb = buttons & mask;
|
||||
mask <<= 1;
|
||||
if (!sb)
|
||||
continue;
|
||||
QPushButton* button = msgBox.addButton((QMessageBox::StandardButton)sb);
|
||||
// Choose the first accept role as the default
|
||||
if (msgBox.defaultButton())
|
||||
continue;
|
||||
if ((defaultButton == QMessageBox::NoButton && buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
|
||||
|| (defaultButton != QMessageBox::NoButton && sb == uint(defaultButton)))
|
||||
msgBox.setDefaultButton(button);
|
||||
}
|
||||
if (msgBox.exec() == -1)
|
||||
return QMessageBox::Cancel;
|
||||
return msgBox.standardButton(msgBox.clickedButton());
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QxtConfirmationMessage::confirmationText
|
||||
\brief the confirmation text
|
||||
|
||||
The default value is \bold {"Do not show again."}
|
||||
*/
|
||||
QString QxtConfirmationMessage::confirmationText() const
|
||||
{
|
||||
return qxt_d().confirm->text();
|
||||
}
|
||||
|
||||
void QxtConfirmationMessage::setConfirmationText(const QString& confirmation)
|
||||
{
|
||||
qxt_d().confirm->setText(confirmation);
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QxtConfirmationMessage::overrideSettingsApplication
|
||||
\brief the override application name used for settings
|
||||
|
||||
QCoreApplication::applicationName is used when no \bold overrideSettingsApplication
|
||||
has been set. The application name falls back to \bold "QxtConfirmationMessage"
|
||||
when no QCoreApplication::applicationName has been set.
|
||||
|
||||
The default value is an empty string.
|
||||
*/
|
||||
QString QxtConfirmationMessage::overrideSettingsApplication() const
|
||||
{
|
||||
return qxt_d().overrideApp;
|
||||
}
|
||||
|
||||
void QxtConfirmationMessage::setOverrideSettingsApplication(const QString& application)
|
||||
{
|
||||
qxt_d().overrideApp = application;
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QxtConfirmationMessage::overrideSettingsKey
|
||||
\brief the override key used for settings
|
||||
|
||||
When no \bold overrideSettingsKey has been set, the key is calculated with
|
||||
qChecksum() based on title, text and confirmation message.
|
||||
|
||||
The default value is an empty string.
|
||||
*/
|
||||
QString QxtConfirmationMessage::overrideSettingsKey() const
|
||||
{
|
||||
return qxt_d().overrideKey;
|
||||
}
|
||||
|
||||
void QxtConfirmationMessage::setOverrideSettingsKey(const QString& key)
|
||||
{
|
||||
qxt_d().overrideKey = key;
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QxtConfirmationMessage::overrideSettingsOrganization
|
||||
\brief the override organization name used for settings
|
||||
|
||||
QCoreApplication::organizationName is used when no \bold overrideSettingsOrganization
|
||||
has been set. The organization name falls back to \bold "QxtWidgets" when no
|
||||
QCoreApplication::organizationName has been set.
|
||||
|
||||
The default value is an empty string.
|
||||
*/
|
||||
QString QxtConfirmationMessage::overrideSettingsOrganization() const
|
||||
{
|
||||
return qxt_d().overrideOrg;
|
||||
}
|
||||
|
||||
void QxtConfirmationMessage::setOverrideSettingsOrganization(const QString& organization)
|
||||
{
|
||||
qxt_d().overrideOrg = organization;
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QxtConfirmationMessage::rememberOnReject
|
||||
\brief whether \bold {"Do not show again."} option is stored even
|
||||
if the message box is rejected (eg. user presses Cancel).
|
||||
|
||||
The default value is \c false.
|
||||
*/
|
||||
bool QxtConfirmationMessage::rememberOnReject() const
|
||||
{
|
||||
return qxt_d().remember;
|
||||
}
|
||||
|
||||
void QxtConfirmationMessage::setRememberOnReject(bool remember)
|
||||
{
|
||||
qxt_d().remember = remember;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns The format used for storing settings.
|
||||
|
||||
The default value is QSettings::NativeFormat.
|
||||
*/
|
||||
QSettings::Format QxtConfirmationMessage::settingsFormat()
|
||||
{
|
||||
return QxtConfirmationMessagePrivate::format;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the \a format used for storing settings.
|
||||
*/
|
||||
void QxtConfirmationMessage::setSettingsFormat(QSettings::Format format)
|
||||
{
|
||||
QxtConfirmationMessagePrivate::format = format;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns The scope used for storing settings.
|
||||
|
||||
The default value is QSettings::UserScope.
|
||||
*/
|
||||
QSettings::Scope QxtConfirmationMessage::settingsScope()
|
||||
{
|
||||
return QxtConfirmationMessagePrivate::scope;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the \a scope used for storing settings.
|
||||
*/
|
||||
void QxtConfirmationMessage::setSettingsScope(QSettings::Scope scope)
|
||||
{
|
||||
QxtConfirmationMessagePrivate::scope = scope;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the path used for storing settings.
|
||||
|
||||
The default value is an empty string.
|
||||
*/
|
||||
QString QxtConfirmationMessage::settingsPath()
|
||||
{
|
||||
return QxtConfirmationMessagePrivate::path;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the \a path used for storing settings.
|
||||
*/
|
||||
void QxtConfirmationMessage::setSettingsPath(const QString& path)
|
||||
{
|
||||
QxtConfirmationMessagePrivate::path = path;
|
||||
}
|
||||
|
||||
/*!
|
||||
Shows the confirmation message if necessary. The confirmation message is not
|
||||
shown in case \bold {"Do not show again."} has been checked while the same
|
||||
confirmation message was earlierly accepted.
|
||||
|
||||
A confirmation message is identified by the combination of title,
|
||||
QMessageBox::text and optional QMessageBox::informativeText.
|
||||
|
||||
A clicked button with role QDialogButtonBox::AcceptRole or
|
||||
QDialogButtonBox::YesRole is considered as "accepted".
|
||||
|
||||
\warning This function does not reimplement but shadows QMessageBox::exec().
|
||||
|
||||
\sa QWidget::windowTitle, QMessageBox::text, QMessageBox::informativeText
|
||||
*/
|
||||
int QxtConfirmationMessage::exec()
|
||||
{
|
||||
int res = qxt_d().showAgain();
|
||||
if (res == -1)
|
||||
res = QMessageBox::exec();
|
||||
return res;
|
||||
}
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
*/
|
||||
void QxtConfirmationMessage::done(int result)
|
||||
{
|
||||
QDialogButtonBox* buttons = this->findChild<QDialogButtonBox*>();
|
||||
Q_ASSERT(buttons != 0);
|
||||
|
||||
int role = buttons->buttonRole(clickedButton());
|
||||
if (qxt_d().confirm->isChecked() &&
|
||||
(qxt_d().remember || role != QDialogButtonBox::RejectRole))
|
||||
{
|
||||
qxt_d().doNotShowAgain(result);
|
||||
}
|
||||
QMessageBox::done(result);
|
||||
}
|
||||
|
||||
/*!
|
||||
Resets this instance of QxtConfirmationMessage. A reseted confirmation
|
||||
message is shown again until user checks \bold {"Do not show again."} and
|
||||
accepts the confirmation message.
|
||||
*/
|
||||
void QxtConfirmationMessage::reset()
|
||||
{
|
||||
qxt_d().reset();
|
||||
}
|
||||
94
src/qtgui/widgets/qxtconfirmationmessage.h
Normal file
94
src/qtgui/widgets/qxtconfirmationmessage.h
Normal file
@ -0,0 +1,94 @@
|
||||
#ifndef QXTCONFIRMATIONMESSAGE_H
|
||||
/****************************************************************************
|
||||
** Copyright (c) 2006 - 2011, the LibQxt project.
|
||||
** See the Qxt AUTHORS file for a list of authors and copyright holders.
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** * Neither the name of the LibQxt project nor the
|
||||
** names of its contributors may be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
** <http://libqxt.org> <foundation@libqxt.org>
|
||||
*****************************************************************************/
|
||||
|
||||
#define QXTCONFIRMATIONMESSAGE_H
|
||||
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include "qxtglobal.h"
|
||||
|
||||
class QxtConfirmationMessagePrivate;
|
||||
|
||||
class QXT_GUI_EXPORT QxtConfirmationMessage : public QMessageBox
|
||||
{
|
||||
Q_OBJECT
|
||||
QXT_DECLARE_PRIVATE(QxtConfirmationMessage)
|
||||
Q_PROPERTY(QString confirmationText READ confirmationText WRITE setConfirmationText)
|
||||
Q_PROPERTY(QString overrideSettingsApplication READ overrideSettingsApplication WRITE setOverrideSettingsApplication)
|
||||
Q_PROPERTY(QString overrideSettingsKey READ overrideSettingsKey WRITE setOverrideSettingsKey)
|
||||
Q_PROPERTY(QString overrideSettingsOrganization READ overrideSettingsOrganization WRITE setOverrideSettingsOrganization)
|
||||
Q_PROPERTY(bool rememberOnReject READ rememberOnReject WRITE setRememberOnReject)
|
||||
|
||||
public:
|
||||
explicit QxtConfirmationMessage(QWidget* parent = 0);
|
||||
virtual ~QxtConfirmationMessage();
|
||||
|
||||
QxtConfirmationMessage(QMessageBox::Icon icon,
|
||||
const QString& title, const QString& text, const QString& confirmation = QString(),
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::NoButton, QWidget* parent = 0,
|
||||
Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
|
||||
|
||||
static QMessageBox::StandardButton confirm(QWidget* parent,
|
||||
const QString& title, const QString& text, const QString& confirmation = QString(),
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
|
||||
|
||||
QString confirmationText() const;
|
||||
void setConfirmationText(const QString& confirmation);
|
||||
|
||||
QString overrideSettingsApplication() const;
|
||||
void setOverrideSettingsApplication(const QString& application);
|
||||
|
||||
QString overrideSettingsKey() const;
|
||||
void setOverrideSettingsKey(const QString& key);
|
||||
|
||||
QString overrideSettingsOrganization() const;
|
||||
void setOverrideSettingsOrganization(const QString& organization);
|
||||
|
||||
bool rememberOnReject() const;
|
||||
void setRememberOnReject(bool remember);
|
||||
|
||||
static QSettings::Format settingsFormat();
|
||||
static void setSettingsFormat(QSettings::Format format);
|
||||
|
||||
static QSettings::Scope settingsScope();
|
||||
static void setSettingsScope(QSettings::Scope scope);
|
||||
|
||||
static QString settingsPath();
|
||||
static void setSettingsPath(const QString& path);
|
||||
|
||||
public Q_SLOTS:
|
||||
int exec();
|
||||
void reset();
|
||||
virtual void done(int result);
|
||||
};
|
||||
|
||||
#endif // QXTCONFIRMATIONMESSAGE_H
|
||||
233
src/qtgui/widgets/qxtglobal.h
Normal file
233
src/qtgui/widgets/qxtglobal.h
Normal file
@ -0,0 +1,233 @@
|
||||
|
||||
/****************************************************************************
|
||||
** Copyright (c) 2006 - 2011, the LibQxt project.
|
||||
** See the Qxt AUTHORS file for a list of authors and copyright holders.
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** * Neither the name of the LibQxt project nor the
|
||||
** names of its contributors may be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
** <http://libqxt.org> <foundation@libqxt.org>
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QXTGLOBAL_H
|
||||
#define QXTGLOBAL_H
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#define QXT_VERSION 0x000700
|
||||
#define QXT_VERSION_STR "0.7.0"
|
||||
|
||||
//--------------------------global macros------------------------------
|
||||
|
||||
#ifndef QXT_NO_MACROS
|
||||
|
||||
#ifndef _countof
|
||||
#define _countof(x) (sizeof(x)/sizeof(*x))
|
||||
#endif
|
||||
|
||||
#endif // QXT_NO_MACROS
|
||||
|
||||
//--------------------------export macros------------------------------
|
||||
|
||||
#define QXT_DLLEXPORT DO_NOT_USE_THIS_ANYMORE
|
||||
|
||||
#if !defined(QXT_STATIC) && !defined(QXT_DOXYGEN_RUN)
|
||||
# if defined(BUILD_QXT_CORE)
|
||||
# define QXT_CORE_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
# define QXT_CORE_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define QXT_CORE_EXPORT
|
||||
#endif // BUILD_QXT_CORE
|
||||
|
||||
#if !defined(QXT_STATIC) && !defined(QXT_DOXYGEN_RUN)
|
||||
# if defined(BUILD_QXT_GUI)
|
||||
# define QXT_GUI_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
# define QXT_GUI_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define QXT_GUI_EXPORT
|
||||
#endif // BUILD_QXT_GUI
|
||||
|
||||
#if !defined(QXT_STATIC) && !defined(QXT_DOXYGEN_RUN)
|
||||
# if defined(BUILD_QXT_NETWORK)
|
||||
# define QXT_NETWORK_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
# define QXT_NETWORK_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define QXT_NETWORK_EXPORT
|
||||
#endif // BUILD_QXT_NETWORK
|
||||
|
||||
#if !defined(QXT_STATIC) && !defined(QXT_DOXYGEN_RUN)
|
||||
# if defined(BUILD_QXT_SQL)
|
||||
# define QXT_SQL_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
# define QXT_SQL_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define QXT_SQL_EXPORT
|
||||
#endif // BUILD_QXT_SQL
|
||||
|
||||
#if !defined(QXT_STATIC) && !defined(QXT_DOXYGEN_RUN)
|
||||
# if defined(BUILD_QXT_WEB)
|
||||
# define QXT_WEB_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
# define QXT_WEB_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define QXT_WEB_EXPORT
|
||||
#endif // BUILD_QXT_WEB
|
||||
|
||||
#if !defined(QXT_STATIC) && !defined(QXT_DOXYGEN_RUN)
|
||||
# if defined(BUILD_QXT_BERKELEY)
|
||||
# define QXT_BERKELEY_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
# define QXT_BERKELEY_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define QXT_BERKELEY_EXPORT
|
||||
#endif // BUILD_QXT_BERKELEY
|
||||
|
||||
#if !defined(QXT_STATIC) && !defined(QXT_DOXYGEN_RUN)
|
||||
# if defined(BUILD_QXT_ZEROCONF)
|
||||
# define QXT_ZEROCONF_EXPORT Q_DECL_EXPORT
|
||||
# else
|
||||
# define QXT_ZEROCONF_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define QXT_ZEROCONF_EXPORT
|
||||
#endif // QXT_ZEROCONF_EXPORT
|
||||
|
||||
#if defined(BUILD_QXT_CORE) || defined(BUILD_QXT_GUI) || defined(BUILD_QXT_SQL) || defined(BUILD_QXT_NETWORK) || defined(BUILD_QXT_WEB) || defined(BUILD_QXT_BERKELEY) || defined(BUILD_QXT_ZEROCONF)
|
||||
# define BUILD_QXT
|
||||
#endif
|
||||
|
||||
QXT_CORE_EXPORT const char* qxtVersion();
|
||||
|
||||
#ifndef QT_BEGIN_NAMESPACE
|
||||
#define QT_BEGIN_NAMESPACE
|
||||
#endif
|
||||
|
||||
#ifndef QT_END_NAMESPACE
|
||||
#define QT_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
#ifndef QT_FORWARD_DECLARE_CLASS
|
||||
#define QT_FORWARD_DECLARE_CLASS(Class) class Class;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
** This file is derived from code bearing the following notice:
|
||||
** The sole author of this file, Adam Higerd, has explicitly disclaimed all
|
||||
** copyright interest and protection for the content within. This file has
|
||||
** been placed in the public domain according to United States copyright
|
||||
** statute and case law. In jurisdictions where this public domain dedication
|
||||
** is not legally recognized, anyone who receives a copy of this file is
|
||||
** permitted to use, modify, duplicate, and redistribute this file, in whole
|
||||
** or in part, with no restrictions or conditions. In these jurisdictions,
|
||||
** this file shall be copyright (C) 2006-2008 by Adam Higerd.
|
||||
****************************************************************************/
|
||||
|
||||
#define QXT_DECLARE_PRIVATE(PUB) friend class PUB##Private; QxtPrivateInterface<PUB, PUB##Private> qxt_d;
|
||||
#define QXT_DECLARE_PUBLIC(PUB) friend class PUB;
|
||||
#define QXT_INIT_PRIVATE(PUB) qxt_d.setPublic(this);
|
||||
#define QXT_D(PUB) PUB##Private& d = qxt_d()
|
||||
#define QXT_P(PUB) PUB& p = qxt_p()
|
||||
|
||||
template <typename PUB>
|
||||
class QxtPrivate
|
||||
{
|
||||
public:
|
||||
virtual ~QxtPrivate()
|
||||
{}
|
||||
inline void QXT_setPublic(PUB* pub)
|
||||
{
|
||||
qxt_p_ptr = pub;
|
||||
}
|
||||
|
||||
protected:
|
||||
inline PUB& qxt_p()
|
||||
{
|
||||
return *qxt_p_ptr;
|
||||
}
|
||||
inline const PUB& qxt_p() const
|
||||
{
|
||||
return *qxt_p_ptr;
|
||||
}
|
||||
inline PUB* qxt_ptr()
|
||||
{
|
||||
return qxt_p_ptr;
|
||||
}
|
||||
inline const PUB* qxt_ptr() const
|
||||
{
|
||||
return qxt_p_ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
PUB* qxt_p_ptr;
|
||||
};
|
||||
|
||||
template <typename PUB, typename PVT>
|
||||
class QxtPrivateInterface
|
||||
{
|
||||
friend class QxtPrivate<PUB>;
|
||||
public:
|
||||
QxtPrivateInterface()
|
||||
{
|
||||
pvt = new PVT;
|
||||
}
|
||||
~QxtPrivateInterface()
|
||||
{
|
||||
delete pvt;
|
||||
}
|
||||
|
||||
inline void setPublic(PUB* pub)
|
||||
{
|
||||
pvt->QXT_setPublic(pub);
|
||||
}
|
||||
inline PVT& operator()()
|
||||
{
|
||||
return *static_cast<PVT*>(pvt);
|
||||
}
|
||||
inline const PVT& operator()() const
|
||||
{
|
||||
return *static_cast<PVT*>(pvt);
|
||||
}
|
||||
inline PVT * operator->()
|
||||
{
|
||||
return static_cast<PVT*>(pvt);
|
||||
}
|
||||
inline const PVT * operator->() const
|
||||
{
|
||||
return static_cast<PVT*>(pvt);
|
||||
}
|
||||
private:
|
||||
QxtPrivateInterface(const QxtPrivateInterface&) { }
|
||||
QxtPrivateInterface& operator=(const QxtPrivateInterface&) { }
|
||||
QxtPrivate<PUB>* pvt;
|
||||
};
|
||||
|
||||
#endif // QXT_GLOBAL
|
||||
Loading…
x
Reference in New Issue
Block a user