Version: 2.1 (using KDE KDE 3.5.5) Installed from: SuSE RPMs It would be nice if Ktorrent had a loading bar or a icon, kind of like something Konqueror has, the spinning gear, that way the people that don't want to load the search results in a browser they know if the pages are loading or not. It takes a couple of minutes before I even to start seeing any results on my screen, so some times I begin to wonder if it really is loading or not which is why some thing to show the progress of it loading would be a good thing.
Not a bad idea, we will see if this is possible
Looking at the KHTML docs, this should be possible. However, I don't know when we can get to this.
Well that is understandable, I'm glad to know that it is possible to do. I hope to see this one day
SVN commit 654693 by guisson: Added progress bar to status bar which will be shown when you are searching with the search plugin. BUG: 142248 M +1 -0 ChangeLog M +25 -1 apps/ktorrent/ktorrent.cpp M +4 -0 apps/ktorrent/ktorrent.h M +7 -0 libktorrent/interfaces/guiinterface.h M +32 -2 plugins/search/searchwidget.cpp M +6 -3 plugins/search/searchwidget.h --- trunk/extragear/network/ktorrent/ChangeLog #654692:654693 @@ -14,6 +14,7 @@ - Added option to move finished downloads to a different directory - Readded feature to show the total and the number of running torrents in the tab of each view +- Added progress bar in status bar when searching Changes in 2.1.2 - Fix 2 security vulnerabilities (thanks to Bryan Burns from Juniper Networks --- trunk/extragear/network/ktorrent/apps/ktorrent/ktorrent.cpp #654692:654693 @@ -111,7 +111,7 @@ KTorrent::KTorrent() : DMainWindow(0,"KTorrent"),m_group_view(0), - m_view_man(0), m_systray_icon(0) + m_view_man(0), m_systray_icon(0),m_status_prog(0) { setHidden(true); //setToolviewStyle(KMdi::TextAndIcon); @@ -913,5 +913,29 @@ m_core->loadSilentlyDir(url, savedir); } +KProgress* KTorrent::addProgressBarToStatusBar() +{ + if (m_status_prog) + return 0; + + KStatusBar* sb = statusBar(); + m_status_prog = new KProgress(100,sb); + m_status_prog->setValue(0); + sb->addWidget(m_status_prog); + m_status_prog->show(); + return m_status_prog; +} + +void KTorrent::removeProgressBarFromStatusBar(KProgress* p) +{ + if (m_status_prog != p) + return; + + KStatusBar* sb = statusBar(); + sb->removeWidget(p); + delete p; + m_status_prog = 0; +} + #include "ktorrent.moc" --- trunk/extragear/network/ktorrent/apps/ktorrent/ktorrent.h #654692:654693 @@ -105,6 +105,8 @@ virtual const kt::TorrentInterface* getCurrentTorrent() const; virtual KToolBar* addToolBar(const char* name); virtual void removeToolBar(KToolBar* tb); + virtual KProgress* addProgressBarToStatusBar(); + virtual void removeProgressBarFromStatusBar(KProgress* p); QString getStatusInfo(); QString getStatusTransfer(); @@ -216,6 +218,8 @@ KAction* m_queueaction; KAction* m_datacheck; KAction* m_ipfilter; + + KProgress* m_status_prog; }; #endif // _KTORRENT_H_ --- trunk/extragear/network/ktorrent/libktorrent/interfaces/guiinterface.h #654692:654693 @@ -26,6 +26,7 @@ class QIconSet; class QString; class KToolBar; +class KProgress; namespace kt { @@ -90,6 +91,12 @@ /// Remove a view listener void removeViewListener(ViewListener* vl); + /// Add a progress bar tot the status bar, if one is already present this will fail and return 0 + virtual KProgress* addProgressBarToStatusBar() = 0; + + /// Remove the progress bar from the status bar + virtual void removeProgressBarFromStatusBar(KProgress* p) = 0; + /** * Add a new tab page to the GUI * @param page The widget --- trunk/extragear/network/ktorrent/plugins/search/searchwidget.cpp #654692:654693 @@ -38,6 +38,7 @@ #include <kio/job.h> #include <kmessagebox.h> #include <kfiledialog.h> +#include <kprogress.h> #include <util/log.h> #include <torrent/globals.h> #include <interfaces/guiinterface.h> @@ -105,12 +106,19 @@ KParts::PartManager* pman = html_part->partManager(); connect(pman,SIGNAL(partAdded(KParts::Part*)),this,SLOT(onFrameAdded(KParts::Part* ))); + + connect(html_part->browserExtension(),SIGNAL(loadingProgress(int)),this,SLOT(loadingProgress(int))); + prog = 0; } SearchWidget::~SearchWidget() { - + if (prog) + { + sp->getGUI()->removeProgressBarFromStatusBar(prog); + prog = 0; + } } void SearchWidget::updateSearchEngines(const SearchEngineList & sl) @@ -189,7 +197,6 @@ void SearchWidget::onFinished() { - statusBarMsg(i18n("Search finished")); } void SearchWidget::onOpenTorrent(const KURL & url) @@ -237,6 +244,29 @@ { sp->getCore()->load(url); } + + void SearchWidget::loadingProgress(int perc) + { + if (perc < 100 && !prog) + { + prog = sp->getGUI()->addProgressBarToStatusBar(); + if (prog) + prog->setValue(perc); + } + else if (prog && perc < 100) + { + prog->setValue(perc); + } + else if (perc == 100) + { + if (prog) + { + sp->getGUI()->removeProgressBarFromStatusBar(prog); + prog = 0; + } + statusBarMsg(i18n("Search finished")); + } + } } #include "searchwidget.moc" --- trunk/extragear/network/ktorrent/plugins/search/searchwidget.h #654692:654693 @@ -25,7 +25,7 @@ #include <kurl.h> class SearchBar; - +class KProgress; class KPopupMenu; namespace KParts @@ -41,7 +41,9 @@ /** - @author Joris Guisson + @author Joris Guisson + + Widget which shows a KHTML window with the users search in it */ class SearchWidget : public QWidget { @@ -71,7 +73,7 @@ void onFrameAdded(KParts::Part* p); void statusBarMsg(const QString & url); void openTorrent(const KURL & url); - + void loadingProgress(int perc); private: HTMLPart* html_part; @@ -79,6 +81,7 @@ KPopupMenu* right_click_menu; int back_id; SearchPlugin* sp; + KProgress* prog; }; }