}
connect(Solid::Networking::notifier(), SIGNAL(shouldConnect()), this, SLOT(slotOnline()));
connect(Solid::Networking::notifier(), SIGNAL(shouldDisconnect()), this, SLOT(slotOffline()));
+ connect(page_next, SIGNAL(clicked()), this, SLOT(slotNextPage()));
+ connect(page_prev, SIGNAL(clicked()), this, SLOT(slotPreviousPage()));
+ connect(page_number, SIGNAL(valueChanged(int)), this, SLOT(slotStartSearch(int)));
}
FreeSound::~FreeSound()
if (m_previewProcess) delete m_previewProcess;
}
-void FreeSound::slotStartSearch()
+void FreeSound::slotStartSearch(int page)
{
m_result.clear();
m_currentPreview.clear();
m_currentUrl.clear();
page_number->blockSignals(true);
- page_number->setValue(0);
+ page_number->setValue(page);
page_number->blockSignals(false);
QString uri;
if (m_service == FREESOUND) {
uri = "http://www.freesound.org/api/sounds/search/?q=";
uri.append(search_text->text());
+ if (page > 1) uri.append("&p=" + QString::number(page));
uri.append("&api_key=a1772c8236e945a4bee30a64058dabf8");
}
else if (m_service == OPENCLIPART) {
uri = "http://openclipart.org/api/search/?query=";
uri.append(search_text->text());
- //water&page=4
+ if (page > 1) uri.append("&page=" + QString::number(page));
}
KIO::TransferJob *job = KIO::get(KUrl(uri));
connect (job, SIGNAL( data(KIO::Job *, const QByteArray & )), this, SLOT(slotDataIsHere(KIO::Job *,const QByteArray &)));
search_info->setText(i18n("You need to be online\n for searching"));
}
+void FreeSound::slotNextPage()
+{
+ int ix = page_number->value();
+ if (search_results->count() > 0) page_number->setValue(ix + 1);
+}
+
+void FreeSound::slotPreviousPage()
+{
+ int ix = page_number->value();
+ if (ix > 1) page_number->setValue(ix - 1);
+}
+
<rect>
<x>0</x>
<y>0</y>
- <width>250</width>
- <height>227</height>
+ <width>360</width>
+ <height>229</height>
</rect>
</property>
<property name="windowTitle">
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="prefix">
+ <string>page </string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
</widget>
</item>
<item row="3" column="3">
</property>
</widget>
</item>
- <item row="4" column="0" colspan="4">
- <widget class="QLabel" name="search_info">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="4" column="4">
- <widget class="QDialogButtonBox" name="ButtonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Close</set>
- </property>
- </widget>
+ <item row="4" column="0" colspan="5">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="search_info">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="ButtonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>