clear();
searchResult = result;
- model->setColumnCount(2);
- model->setRowCount(result.count());
+ if(searchResult.count()>0) {
+ setEnabled(true);
+ model->setColumnCount(2);
+ model->setRowCount(result.count());
+
+ int row=0;
+ QHash<QString, QList<Translation*> >::iterator i;
+ for(i = searchResult.begin(); i != searchResult.end(); i++) {
+ addWord(i.key(), row++);
+ }
- int row=0;
- QHash<QString, QList<Translation*> >::iterator i;
- for(i = searchResult.begin(); i != searchResult.end(); i++) {
- addWord(i.key(), row++);
+ model->sort(0);
+ resizeColumns();
}
+ else {
+ QStandardItem* item = new QStandardItem(tr("Can't find any matching words"));
+ item->setFlags(item->flags() ^ Qt::ItemIsEditable);
+ item->setTextAlignment(Qt::AlignCenter);
+ setEnabled(false);
- model->sort(0);
- resizeColumns();
+ model->setItem(0,item);
+ }
setFocus();
}
#include "GoogleDictDialog.h"
QMap<QString, QString> GooglePlugin::languages;
+bool GooglePlugin::noNetworkErrorShowed = false;
+
GooglePlugin::GooglePlugin(QObject *parent): CommonDictInterface(parent),
_name(""),_infoNote("") {
error=http->errorString();
if(error!="" && error!="Unknown error") {
- qDebug()<<error;
- Q_EMIT notify(Notify::Warning,
- tr("GooglePlugin: %1").arg(error));
+ if(!noNetworkErrorShowed) {
+ noNetworkErrorShowed = true;
+ Q_EMIT notify(Notify::Warning,
+ tr("GooglePlugin: %1").arg(error));
+ }
}
QString text = QString::fromUtf8(http->readAll());