Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 157438b5 authored by Scott Wheeler's avatar Scott Wheeler

Don't show the image selection dialog when no matching images were found.

BUG:101088

svn path=/trunk/kdemultimedia/juk/; revision=398532
parent 10adcd55
......@@ -139,7 +139,6 @@ void GoogleFetcher::slotLoadImageURLs(GoogleFetcher::ImageSize size)
QPixmap GoogleFetcher::pixmap()
{
bool chosen = false;
const int selectedIndex = 0;
m_loadedSize = All;
displayWaitMessage();
......@@ -147,24 +146,21 @@ QPixmap GoogleFetcher::pixmap()
QPixmap pixmap;
while(!chosen) {
GoogleFetcherDialog dialog("google", m_imageList, selectedIndex, m_file, 0);
connect(&dialog, SIGNAL(sizeChanged(GoogleFetcher::ImageSize)),
this, SLOT(slotLoadImageURLs(GoogleFetcher::ImageSize)));
connect(this, SIGNAL(signalNewSearch(GoogleImageList &)),
&dialog, SLOT(refreshScreen(GoogleImageList &)));
dialog.exec();
pixmap = dialog.result();
chosen = dialog.takeIt();
if(dialog.newSearch()) {
bool ok;
m_searchString = KInputDialog::getText(i18n("Cover Downloader"),
i18n("Enter new search terms:"),
m_searchString, &ok);
if(ok && !m_searchString.isEmpty())
displayWaitMessage();
else
m_searchString = m_loadedQuery;
if(m_imageList.isEmpty())
chosen = !requestNewSearchTerms(true);
else {
GoogleFetcherDialog dialog("google", m_imageList, m_file, 0);
connect(&dialog, SIGNAL(sizeChanged(GoogleFetcher::ImageSize)),
this, SLOT(slotLoadImageURLs(GoogleFetcher::ImageSize)));
connect(this, SIGNAL(signalNewSearch(GoogleImageList &)),
&dialog, SLOT(refreshScreen(GoogleImageList &)));
dialog.exec();
pixmap = dialog.result();
chosen = dialog.takeIt();
if(dialog.newSearch())
requestNewSearchTerms();
}
}
return pixmap;
......@@ -178,5 +174,20 @@ void GoogleFetcher::displayWaitMessage()
statusBar->clear();
}
#include "googlefetcher.moc"
bool GoogleFetcher::requestNewSearchTerms(bool noResults)
{
bool ok;
m_searchString = KInputDialog::getText(i18n("Cover Downloader"),
noResults ?
i18n("No matching images found, please enter new search terms:") :
i18n("Enter new search terms:"),
m_searchString, &ok);
if(ok && !m_searchString.isEmpty())
displayWaitMessage();
else
m_searchString = m_loadedQuery;
return ok;
}
#include "googlefetcher.moc"
......@@ -52,21 +52,16 @@ public:
GoogleFetcher(const FileHandle &file);
QPixmap pixmap();
signals:
void signalNewSearch(GoogleImageList &images);
private:
void cancel();
void editSearch();
void saveCover();
void previous();
void next();
void displayWaitMessage();
void buildBox();
bool requestNewSearchTerms(bool noResults = false);
private slots:
void slotLoadImageURLs(GoogleFetcher::ImageSize size = All);
signals:
void signalNewSearch(GoogleImageList &images);
private:
FileHandle m_file;
QString m_searchString;
......
......@@ -30,7 +30,6 @@
GoogleFetcherDialog::GoogleFetcherDialog(const QString &name,
const GoogleImageList &imageList,
uint /* selectedIndex */,
const FileHandle &file,
QWidget *parent) :
KDialogBase(parent, name.latin1(), true, QString::null,
......
......@@ -30,7 +30,6 @@ class GoogleFetcherDialog : public KDialogBase
public:
GoogleFetcherDialog(const QString &name,
const GoogleImageList &urlList,
uint selectedIndex,
const FileHandle &file,
QWidget *parent = 0);
......
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