Commit b9961b6b authored by Kurt Hindenburg's avatar Kurt Hindenburg

For wallpaper open dialog convert to QFileDialog

Convert KFileDialog::getImageOpenUrl to QFileDialog::getOpenFileName

Also use supported image types from QImageReader::supportedImageFormats
parent 874de434
......@@ -27,11 +27,12 @@
#include <QFileSystemModel>
#include <QtCore/QUrl>
#include <QtGui/QIcon>
#include <QFileDialog>
#include <QImageReader>
// KDE
#include <QColorDialog>
#include <KWindowSystem>
#include <KFileDialog>
#include <KUrlCompletion>
#include <KLocalizedString>
#include <KConfigGroup>
......@@ -173,12 +174,21 @@ void ColorSchemeEditor::editColorItem(QTableWidgetItem* item)
}
void ColorSchemeEditor::selectWallpaper()
{
const QUrl url = KFileDialog::getImageOpenUrl(QUrl::fromUserInput(_ui->wallpaperPath->text()),
this,
i18nc("@action:button", "Select wallpaper image file"));
// Get supported image formats and convert to QString for getOpenFileName()
const QList<QByteArray> mimeTypes = QImageReader::supportedImageFormats();
QString fileFormats = "(";
Q_FOREACH (const QByteArray &mime, mimeTypes) {
fileFormats += "*." + QString::fromLatin1(mime) + " ";
}
fileFormats += ")";
const QString fileName = QFileDialog::getOpenFileName(this,
i18nc("@action:button", "Select wallpaper image file"),
_ui->wallpaperPath->text(),
i18nc("@action:button", "Supported Images") + fileFormats);
if (!url.isEmpty())
_ui->wallpaperPath->setText(url.path());
if (!fileName.isEmpty())
_ui->wallpaperPath->setText(fileName);
}
void ColorSchemeEditor::wallpaperPathChanged(const QString& path)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment