mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
drop support for native dialogs
Katie no longer needs them, it is that simple Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
94c4266569
commit
551c362824
6 changed files with 9 additions and 246 deletions
|
@ -1307,8 +1307,6 @@ void QColorDialogPrivate::init(const QColor &initial)
|
|||
q->setSizeGripEnabled(false);
|
||||
q->setWindowTitle(QColorDialog::tr("Select Color"));
|
||||
|
||||
nativeDialogInUse = false;
|
||||
|
||||
nextCust = 0;
|
||||
QVBoxLayout *mainLay = new QVBoxLayout(q);
|
||||
// there's nothing in this dialog that benefits from sizing up
|
||||
|
@ -1502,9 +1500,6 @@ void QColorDialog::setCurrentColor(const QColor &color)
|
|||
d->setCurrentColor(color.rgb());
|
||||
d->selectColor(color);
|
||||
d->setCurrentAlpha(color.alpha());
|
||||
|
||||
if (d->nativeDialogInUse)
|
||||
qt_guiPlatformPlugin()->colorDialogSetCurrentColor(this, color);
|
||||
}
|
||||
|
||||
QColor QColorDialog::currentColor() const
|
||||
|
@ -1635,16 +1630,6 @@ void QColorDialog::setVisible(bool visible)
|
|||
if (visible)
|
||||
d->selectedQColor = QColor();
|
||||
|
||||
if (qt_guiPlatformPlugin()->colorDialogSetVisible(this, visible)) {
|
||||
d->nativeDialogInUse = true;
|
||||
// Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
|
||||
// updates the state correctly, but skips showing the non-native version:
|
||||
setAttribute(Qt::WA_DontShowOnScreen);
|
||||
} else {
|
||||
d->nativeDialogInUse = false;
|
||||
setAttribute(Qt::WA_DontShowOnScreen, false);
|
||||
}
|
||||
|
||||
QDialog::setVisible(visible);
|
||||
}
|
||||
|
||||
|
@ -1735,10 +1720,6 @@ QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent)
|
|||
|
||||
QColorDialog::~QColorDialog()
|
||||
{
|
||||
Q_D(QColorDialog);
|
||||
if (d->nativeDialogInUse)
|
||||
qt_guiPlatformPlugin()->colorDialogDelete(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -94,7 +94,6 @@ public:
|
|||
QColorDialog::ColorDialogOptions opts;
|
||||
QPointer<QObject> receiverToDisconnectOnClose;
|
||||
QByteArray memberToDisconnectOnClose;
|
||||
bool nativeDialogInUse;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
@ -278,8 +278,6 @@ QFileDialog::QFileDialog(QWidget *parent,
|
|||
*/
|
||||
QFileDialog::~QFileDialog()
|
||||
{
|
||||
Q_D(QFileDialog);
|
||||
d->deleteNativeDialog_sys();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -439,7 +437,6 @@ QFileDialogPrivate::QFileDialogPrivate()
|
|||
useDefaultCaption(true),
|
||||
defaultFileTypes(true),
|
||||
fileNameLabelExplicitlySat(false),
|
||||
nativeDialogInUse(false),
|
||||
qFileDialogUi(0)
|
||||
{
|
||||
}
|
||||
|
@ -512,19 +509,6 @@ void QFileDialogPrivate::emitFilesSelected(const QStringList &files)
|
|||
emit q->fileSelected(files.first());
|
||||
}
|
||||
|
||||
bool QFileDialogPrivate::canBeNativeDialog()
|
||||
{
|
||||
Q_Q(QFileDialog);
|
||||
if (nativeDialogInUse)
|
||||
return true;
|
||||
if (q->testAttribute(Qt::WA_DontShowOnScreen))
|
||||
return false;
|
||||
|
||||
const QByteArray staticName(QFileDialog::staticMetaObject.className());
|
||||
const QByteArray dynamicName(q->metaObject()->className());
|
||||
return (staticName == dynamicName);
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.5
|
||||
Sets the given \a option to be enabled if \a on is true; otherwise,
|
||||
|
@ -632,30 +616,19 @@ void QFileDialog::setVisible(bool visible)
|
|||
} else if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden))
|
||||
return;
|
||||
|
||||
if (d->canBeNativeDialog()){
|
||||
if (d->setVisible_sys(visible)){
|
||||
d->nativeDialogInUse = true;
|
||||
// Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
|
||||
// updates the state correctly, but skips showing the non-native version:
|
||||
setAttribute(Qt::WA_DontShowOnScreen);
|
||||
const QByteArray staticName(QFileDialog::staticMetaObject.className());
|
||||
const QByteArray dynamicName(metaObject()->className());
|
||||
if (staticName == dynamicName){
|
||||
#ifndef QT_NO_FSCOMPLETER
|
||||
//So the completer don't try to complete and therefore to show a popup
|
||||
d->completer->setModel(0);
|
||||
#endif
|
||||
if (d->proxyModel != 0) {
|
||||
d->completer->setModel(d->proxyModel);
|
||||
} else {
|
||||
d->nativeDialogInUse = false;
|
||||
setAttribute(Qt::WA_DontShowOnScreen, false);
|
||||
#ifndef QT_NO_FSCOMPLETER
|
||||
if (d->proxyModel != 0)
|
||||
d->completer->setModel(d->proxyModel);
|
||||
else
|
||||
d->completer->setModel(d->model);
|
||||
#endif
|
||||
d->completer->setModel(d->model);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!d->nativeDialogInUse)
|
||||
d->qFileDialogUi->fileNameEdit->setFocus();
|
||||
d->qFileDialogUi->fileNameEdit->setFocus();
|
||||
|
||||
QDialog::setVisible(visible);
|
||||
}
|
||||
|
@ -695,10 +668,6 @@ void QFileDialog::setDirectory(const QString &directory)
|
|||
|
||||
d->setLastVisitedDirectory(newDirectory);
|
||||
|
||||
if (d->nativeDialogInUse){
|
||||
d->setDirectory_sys(newDirectory);
|
||||
return;
|
||||
}
|
||||
if (d->rootPath() == newDirectory)
|
||||
return;
|
||||
QModelIndex root = d->model->setRootPath(newDirectory);
|
||||
|
@ -721,7 +690,7 @@ void QFileDialog::setDirectory(const QString &directory)
|
|||
QDir QFileDialog::directory() const
|
||||
{
|
||||
Q_D(const QFileDialog);
|
||||
return QDir(d->nativeDialogInUse ? d->directory_sys() : d->rootPath());
|
||||
return QDir(d->rootPath());
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -735,11 +704,6 @@ void QFileDialog::selectFile(const QString &filename)
|
|||
if (filename.isEmpty())
|
||||
return;
|
||||
|
||||
if (d->nativeDialogInUse){
|
||||
d->selectFile_sys(filename);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!QDir::isRelativePath(filename)) {
|
||||
QFileInfo info(filename);
|
||||
QString filenamePath = info.absoluteDir().path();
|
||||
|
@ -867,9 +831,6 @@ QStringList QFileDialogPrivate::addDefaultSuffixToFiles(const QStringList &files
|
|||
QStringList QFileDialog::selectedFiles() const
|
||||
{
|
||||
Q_D(const QFileDialog);
|
||||
if (d->nativeDialogInUse)
|
||||
return d->addDefaultSuffixToFiles(d->selectedFiles_sys());
|
||||
|
||||
QModelIndexList indexes = d->qFileDialogUi->listView->selectionModel()->selectedRows();
|
||||
QStringList files;
|
||||
files.reserve(indexes.count());
|
||||
|
@ -981,11 +942,6 @@ void QFileDialog::setNameFilters(const QStringList &filters)
|
|||
}
|
||||
d->nameFilters = cleanedFilters;
|
||||
|
||||
if (d->nativeDialogInUse){
|
||||
d->setNameFilters_sys(cleanedFilters);
|
||||
return;
|
||||
}
|
||||
|
||||
d->qFileDialogUi->fileTypeCombo->clear();
|
||||
if (cleanedFilters.isEmpty())
|
||||
return;
|
||||
|
@ -1021,10 +977,6 @@ QStringList QFileDialog::nameFilters() const
|
|||
void QFileDialog::selectNameFilter(const QString &filter)
|
||||
{
|
||||
Q_D(QFileDialog);
|
||||
if (d->nativeDialogInUse) {
|
||||
d->selectNameFilter_sys(filter);
|
||||
return;
|
||||
}
|
||||
int i = -1;
|
||||
if (testOption(HideNameFilterDetails)) {
|
||||
const QStringList filters = qt_strip_filters(qt_make_filter_list(filter));
|
||||
|
@ -1049,9 +1001,6 @@ void QFileDialog::selectNameFilter(const QString &filter)
|
|||
QString QFileDialog::selectedNameFilter() const
|
||||
{
|
||||
Q_D(const QFileDialog);
|
||||
if (d->nativeDialogInUse)
|
||||
return d->selectedNameFilter_sys();
|
||||
|
||||
return d->qFileDialogUi->fileTypeCombo->currentText();
|
||||
}
|
||||
|
||||
|
@ -1081,11 +1030,6 @@ void QFileDialog::setFilter(QDir::Filters filters)
|
|||
{
|
||||
Q_D(QFileDialog);
|
||||
d->model->setFilter(filters);
|
||||
if (d->nativeDialogInUse){
|
||||
d->setFilter_sys();
|
||||
return;
|
||||
}
|
||||
|
||||
d->showHiddenAction->setChecked((filters & QDir::Hidden));
|
||||
}
|
||||
|
||||
|
@ -1166,10 +1110,6 @@ void QFileDialog::setFileMode(QFileDialog::FileMode mode)
|
|||
}
|
||||
}
|
||||
setLabelText(Accept, buttonText);
|
||||
if (d->nativeDialogInUse){
|
||||
d->setFilter_sys();
|
||||
return;
|
||||
}
|
||||
|
||||
d->qFileDialogUi->fileTypeCombo->setEnabled(!testOption(ShowDirsOnly));
|
||||
d->_q_updateOkButton();
|
||||
|
@ -1783,11 +1723,6 @@ void QFileDialog::accept()
|
|||
QStringList files = selectedFiles();
|
||||
if (files.isEmpty())
|
||||
return;
|
||||
if (d->nativeDialogInUse){
|
||||
d->emitFilesSelected(files);
|
||||
QDialog::accept();
|
||||
return;
|
||||
}
|
||||
|
||||
QString lineEditText = d->lineEdit()->text();
|
||||
// "hidden feature" type .. and then enter, and it will move up a dir
|
||||
|
|
|
@ -186,26 +186,7 @@ public:
|
|||
bool fileNameLabelExplicitlySat;
|
||||
QStringList nameFilters;
|
||||
|
||||
// Members for using native dialogs:
|
||||
bool nativeDialogInUse;
|
||||
// setVisible_sys returns true if it ends up showing a native
|
||||
// dialog. Returning false means that a non-native dialog must be
|
||||
// used instead.
|
||||
bool canBeNativeDialog();
|
||||
bool setVisible_sys(bool visible);
|
||||
void deleteNativeDialog_sys();
|
||||
QDialog::DialogCode dialogResultCode_sys();
|
||||
|
||||
void setDirectory_sys(const QString &directory);
|
||||
QString directory_sys() const;
|
||||
void selectFile_sys(const QString &filename);
|
||||
QStringList selectedFiles_sys() const;
|
||||
void setFilter_sys();
|
||||
void setNameFilters_sys(const QStringList &filters);
|
||||
void selectNameFilter_sys(const QString &filter);
|
||||
QString selectedNameFilter_sys() const;
|
||||
//////////////////////////////////////////////
|
||||
|
||||
QScopedPointer<Ui_QFileDialog> qFileDialogUi;
|
||||
|
||||
QString acceptLabel;
|
||||
|
@ -297,61 +278,6 @@ inline QString QFileDialogPrivate::rootPath() const
|
|||
return model->rootPath();
|
||||
}
|
||||
|
||||
inline void QFileDialogPrivate::deleteNativeDialog_sys()
|
||||
{
|
||||
qt_guiPlatformPlugin()->fileDialogDelete(q_func());
|
||||
}
|
||||
|
||||
inline bool QFileDialogPrivate::setVisible_sys(bool visible)
|
||||
{
|
||||
return qt_guiPlatformPlugin()->fileDialogSetVisible(q_func(), visible);
|
||||
}
|
||||
|
||||
inline QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys()
|
||||
{
|
||||
return qt_guiPlatformPlugin()->fileDialogResultCode(q_func());
|
||||
}
|
||||
|
||||
inline void QFileDialogPrivate::setDirectory_sys(const QString &directory)
|
||||
{
|
||||
qt_guiPlatformPlugin()->fileDialogSetDirectory(q_func(), directory);
|
||||
}
|
||||
|
||||
inline QString QFileDialogPrivate::directory_sys() const
|
||||
{
|
||||
return qt_guiPlatformPlugin()->fileDialogDirectory(q_func());
|
||||
}
|
||||
|
||||
inline void QFileDialogPrivate::selectFile_sys(const QString &filename)
|
||||
{
|
||||
qt_guiPlatformPlugin()->fileDialogSelectFile(q_func(), filename);
|
||||
}
|
||||
|
||||
inline QStringList QFileDialogPrivate::selectedFiles_sys() const
|
||||
{
|
||||
return qt_guiPlatformPlugin()->fileDialogSelectedFiles(q_func());
|
||||
}
|
||||
|
||||
inline void QFileDialogPrivate::setFilter_sys()
|
||||
{
|
||||
qt_guiPlatformPlugin()->fileDialogSetFilter(q_func());
|
||||
}
|
||||
|
||||
inline void QFileDialogPrivate::setNameFilters_sys(const QStringList &filters)
|
||||
{
|
||||
qt_guiPlatformPlugin()->fileDialogSetNameFilters(q_func(), filters);
|
||||
}
|
||||
|
||||
inline void QFileDialogPrivate::selectNameFilter_sys(const QString &filter)
|
||||
{
|
||||
qt_guiPlatformPlugin()->fileDialogSelectNameFilter(q_func(), filter);
|
||||
}
|
||||
|
||||
inline QString QFileDialogPrivate::selectedNameFilter_sys() const
|
||||
{
|
||||
return qt_guiPlatformPlugin()->fileDialogSelectedNameFilter(q_func());
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_FILEDIALOG
|
||||
|
|
|
@ -221,68 +221,6 @@ int QGuiPlatformPlugin::platformHint(PlatformHint hint)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void QGuiPlatformPlugin::fileDialogDelete(QFileDialog *)
|
||||
{
|
||||
}
|
||||
|
||||
bool QGuiPlatformPlugin::fileDialogSetVisible(QFileDialog *, bool)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QDialog::DialogCode QGuiPlatformPlugin::fileDialogResultCode(QFileDialog *)
|
||||
{
|
||||
return QDialog::Rejected;
|
||||
}
|
||||
|
||||
void QGuiPlatformPlugin::fileDialogSetDirectory(QFileDialog *, const QString &)
|
||||
{
|
||||
}
|
||||
|
||||
QString QGuiPlatformPlugin::fileDialogDirectory(const QFileDialog *) const
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
void QGuiPlatformPlugin::fileDialogSelectFile(QFileDialog *, const QString &)
|
||||
{
|
||||
}
|
||||
|
||||
QStringList QGuiPlatformPlugin::fileDialogSelectedFiles(const QFileDialog *) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
void QGuiPlatformPlugin::fileDialogSetFilter(QFileDialog *)
|
||||
{
|
||||
}
|
||||
|
||||
void QGuiPlatformPlugin::fileDialogSetNameFilters(QFileDialog *, const QStringList &)
|
||||
{
|
||||
}
|
||||
|
||||
void QGuiPlatformPlugin::fileDialogSelectNameFilter(QFileDialog *, const QString &)
|
||||
{
|
||||
}
|
||||
|
||||
QString QGuiPlatformPlugin::fileDialogSelectedNameFilter(const QFileDialog *) const
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
void QGuiPlatformPlugin::colorDialogDelete(QColorDialog *)
|
||||
{
|
||||
}
|
||||
|
||||
bool QGuiPlatformPlugin::colorDialogSetVisible(QColorDialog *, bool)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void QGuiPlatformPlugin::colorDialogSetCurrentColor(QColorDialog *, const QColor &)
|
||||
{
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qguiplatformplugin.h"
|
||||
|
|
|
@ -53,22 +53,6 @@ public:
|
|||
virtual QIcon systemIcon(const QString &name);
|
||||
virtual QIcon fileSystemIcon(const QFileInfo &name);
|
||||
virtual int platformHint(PlatformHint hint);
|
||||
|
||||
virtual void fileDialogDelete(QFileDialog *);
|
||||
virtual bool fileDialogSetVisible(QFileDialog *, bool);
|
||||
virtual QDialog::DialogCode fileDialogResultCode(QFileDialog *);
|
||||
virtual void fileDialogSetDirectory(QFileDialog *, const QString &);
|
||||
virtual QString fileDialogDirectory(const QFileDialog *) const;
|
||||
virtual void fileDialogSelectFile(QFileDialog *, const QString &);
|
||||
virtual QStringList fileDialogSelectedFiles(const QFileDialog *) const;
|
||||
virtual void fileDialogSetFilter(QFileDialog *);
|
||||
virtual void fileDialogSetNameFilters(QFileDialog *, const QStringList &);
|
||||
virtual void fileDialogSelectNameFilter(QFileDialog *, const QString &);
|
||||
virtual QString fileDialogSelectedNameFilter(const QFileDialog *) const;
|
||||
|
||||
virtual void colorDialogDelete(QColorDialog *);
|
||||
virtual bool colorDialogSetVisible(QColorDialog *, bool);
|
||||
virtual void colorDialogSetCurrentColor(QColorDialog *, const QColor &);
|
||||
};
|
||||
|
||||
// internal
|
||||
|
|
Loading…
Add table
Reference in a new issue