#include <KFileDialog>
#include <kio/job.h>
#include <KIO/NetAccess>
+#include <Solid/Networking>
#include <KRun>
+#ifdef USE_QJSON
#include <qjson/parser.h>
+#endif
const int imageRole = Qt::UserRole;
const int urlRole = Qt::UserRole + 1;
setFont(KGlobalSettings::toolBarFont());
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
+#ifdef USE_QJSON
service_list->addItem(i18n("Freesound Audio Library"), FREESOUND);
+#endif
service_list->addItem(i18n("Open Clip Art Graphic Library"), OPENCLIPART);
setWindowTitle(i18n("Search Online Resources"));
connect(button_search, SIGNAL(clicked()), this, SLOT(slotStartSearch()));
connect(m_previewProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(slotPreviewStatusChanged(QProcess::ProcessState)));
connect(service_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChangeService()));
sound_image->setFixedWidth(180);
+ if (Solid::Networking::status() == Solid::Networking::Unconnected) {
+ slotOffline();
+ }
+ connect(Solid::Networking::notifier(), SIGNAL(shouldConnect()), this, SLOT(slotOnline()));
+ connect(Solid::Networking::notifier(), SIGNAL(shouldDisconnect()), this, SLOT(slotOffline()));
}
FreeSound::~FreeSound()
search_results->blockSignals(true);
search_results->clear();
if (m_service == FREESOUND) {
+#ifdef USE_QJSON
QJson::Parser parser;
bool ok;
//kDebug()<<"// GOT RESULT: "<<m_result;
++i;
}
}
+#endif
}
else if (m_service == OPENCLIPART) {
QDomDocument doc;
if (!search_text->text().isEmpty()) slotStartSearch();
}
+void FreeSound::slotOnline()
+{
+ button_search->setEnabled(true);
+ search_info->setText(QString());
+}
+
+void FreeSound::slotOffline()
+{
+ button_search->setEnabled(false);
+ search_info->setText(i18n("You need to be online\n for searching"));
+}
+