void DolphinMainWindow::searchItems(const KUrl& url)
{
m_activeViewContainer->setUrl(url);
+
+ // The Nepomuk IO-slave does not provide any progress information. Give
+ // an immediate hint to the user that a searching is done:
+ DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
+ statusBar->setProgressText(i18nc("@info", "Searching..."));
+ statusBar->setProgress(-1);
}
void DolphinMainWindow::slotTabMoved(int from, int to)
QWidget* parent,
const KUrl& url) :
QWidget(parent),
- m_showProgress(false),
m_isFolderWritable(false),
m_mainWindow(mainWindow),
m_topLayout(0),
void DolphinViewContainer::updateProgress(int percent)
{
- if (!m_showProgress) {
- // Only show the directory loading progress if the status bar does
- // not contain another progress information. This means that
- // the directory loading progress information has the lowest priority.
- const QString progressText(m_statusBar->progressText());
- const QString loadingText(i18nc("@info:progress", "Loading folder..."));
- m_showProgress = progressText.isEmpty() || (progressText == loadingText);
- if (m_showProgress) {
- m_statusBar->setProgressText(loadingText);
- m_statusBar->setProgress(0);
- }
- }
-
- if (m_showProgress) {
- m_statusBar->setProgress(percent);
+ if (m_statusBar->progressText().isEmpty()) {
+ m_statusBar->setProgressText(i18nc("@info:progress", "Loading folder..."));
}
+ m_statusBar->setProgress(percent);
}
void DolphinViewContainer::slotDirListerCompleted()
{
- if (m_showProgress) {
+ if (!m_statusBar->progressText().isEmpty()) {
m_statusBar->setProgressText(QString());
m_statusBar->setProgress(100);
- m_showProgress = false;
}
updateStatusBar();
void slotHistoryChanged();
private:
- bool m_showProgress;
bool m_isFolderWritable;
DolphinMainWindow* m_mainWindow;
void DolphinStatusBar::setProgress(int percent)
{
+ // show a busy indicator if a value < 0 is provided:
+ m_progressBar->setMaximum((percent < 0) ? 0 : 100);
+
if (percent < 0) {
percent = 0;
} else if (percent > 100) {
m_progressBar->setValue(m_progress);
if (!m_progressBar->isVisible() || (percent == 100)) {
- QTimer::singleShot(300, this, SLOT(updateProgressInfo()));
+ updateProgressInfo();
}
const QString& defaultText = m_messageLabel->defaultText();
QMetaObject::invokeMethod(this, "assureVisibleText", Qt::QueuedConnection);
}
-void DolphinStatusBar::updateProgressInfo()
-{
- const bool isErrorShown = (m_messageLabel->type() == Error);
- if (m_progress < 100) {
- // show the progress information and hide the extensions
- setExtensionsVisible(false);
- if (!isErrorShown) {
- m_progressText->show();
- m_progressBar->show();
- }
- } else {
- // hide the progress information and show the extensions
- m_progressText->hide();
- m_progressBar->hide();
- assureVisibleText();
- }
-}
-
void DolphinStatusBar::updateSpaceInfoContent(const KUrl& url)
{
m_spaceInfo->setUrl(url);
QApplication::sendEvent(m_zoomSlider, &toolTipEvent);
}
+void DolphinStatusBar::updateProgressInfo()
+{
+ const bool isErrorShown = (m_messageLabel->type() == Error);
+ if (m_progress < 100) {
+ // show the progress information and hide the extensions
+ setExtensionsVisible(false);
+ if (!isErrorShown) {
+ m_progressText->show();
+ m_progressBar->show();
+ }
+ } else {
+ // hide the progress information and show the extensions
+ m_progressText->hide();
+ m_progressBar->hide();
+ assureVisibleText();
+ }
+}
+
void DolphinStatusBar::setExtensionsVisible(bool visible)
{
bool spaceInfoVisible = visible;
virtual void resizeEvent(QResizeEvent* event);
private slots:
- void updateProgressInfo();
-
/**
* Is invoked, when the URL of the DolphinView, where the
* statusbar belongs too, has been changed. The space information
void showZoomSliderToolTip(int zoomLevel);
private:
+ void updateProgressInfo();
+
/**
* Makes the space information widget and zoom slider widget
* visible, if \a visible is true and the settings allow to show