m_topLayout->setSpacing(0);
m_topLayout->setMargin(0);
- connect(m_mainWindow, SIGNAL(activeViewChanged()),
- this, SLOT(updateActivationState()));
-
QClipboard* clipboard = QApplication::clipboard();
connect(clipboard, SIGNAL(dataChanged()),
this, SLOT(updateCutItems()));
m_urlNavigator = new KUrlNavigator(DolphinSettings::instance().placesModel(), url, this);
+ connect(m_urlNavigator, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&)),
+ m_mainWindow, SLOT(dropUrls(const KUrl::List&, const KUrl&)));
+ connect(m_urlNavigator, SIGNAL(activated()),
+ this, SLOT(activate()));
const GeneralSettings* settings = DolphinSettings::instance().generalSettings();
m_urlNavigator->setUrlEditable(settings->editableUrl());
this, SLOT(updateStatusBar()));
connect(m_dirLister, SIGNAL(completed()),
this, SLOT(updateItemCount()));
- connect(m_dirLister, SIGNAL(completed()),
- this, SLOT(updateCutItems()));
- connect(m_dirLister, SIGNAL(newItems(const KFileItemList&)),
- this, SLOT(generatePreviews(const KFileItemList&)));
connect(m_dirLister, SIGNAL(infoMessage(const QString&)),
this, SLOT(showInfoMessage(const QString&)));
connect(m_dirLister, SIGNAL(errorMessage(const QString&)),
m_dirLister,
m_dirModel,
m_proxyModel,
- mode,
- showHiddenFiles);
+ mode);
connect(m_view, SIGNAL(urlChanged(const KUrl&)),
m_urlNavigator, SLOT(setUrl(const KUrl&)));
connect(m_view, SIGNAL(requestContextMenu(KFileItem*, const KUrl&)),
this, SLOT(openContextMenu(KFileItem*, const KUrl&)));
connect(m_view, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&)),
m_mainWindow, SLOT(dropUrls(const KUrl::List&, const KUrl&)));
+ connect(m_view, SIGNAL(contentsMoved(int, int)),
+ this, SLOT(saveContentsPos(int, int)));
+ connect(m_view, SIGNAL(requestItemInfo(const KUrl&)),
+ this, SLOT(showItemInfo(const KUrl&)));
+ connect(m_view, SIGNAL(errorMessage(const QString&)),
+ this, SLOT(showErrorMessage(const QString&)));
+ connect(m_view, SIGNAL(infoMessage(const QString&)),
+ this, SLOT(showInfoMessage(const QString&)));
connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)),
m_view, SLOT(setUrl(const KUrl&)));
}
}
-DolphinStatusBar* DolphinViewContainer::statusBar() const
-{
- return m_statusBar;
-}
-
bool DolphinViewContainer::isFilterBarVisible() const
{
return m_filterBar->isVisible();
return m_dirModel->itemForIndex(dirModelIndex);
}
-void DolphinViewContainer::rename(const KUrl& source, const QString& newName)
+void DolphinViewContainer::updateProgress(int percent)
{
- bool ok = false;
-
- if (newName.isEmpty() || (source.fileName() == newName)) {
- return;
- }
-
- KUrl dest(source.upUrl());
- dest.addPath(newName);
-
- const bool destExists = KIO::NetAccess::exists(dest, false, this);
- if (destExists) {
- // the destination already exists, hence ask the user
- // how to proceed...
- KIO::RenameDialog renameDialog(this,
- i18n("File Already Exists"),
- source.path(),
- dest.path(),
- KIO::M_OVERWRITE);
- switch (renameDialog.exec()) {
- case KIO::R_OVERWRITE:
- // the destination should be overwritten
- ok = KIO::NetAccess::file_move(source, dest, -1, true);
- break;
-
- case KIO::R_RENAME: {
- // a new name for the destination has been used
- KUrl newDest(renameDialog.newDestUrl());
- ok = KIO::NetAccess::file_move(source, newDest);
- break;
- }
-
- default:
- // the renaming operation has been canceled
- return;
+ 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());
+ m_showProgress = progressText.isEmpty() ||
+ (progressText == i18n("Loading folder..."));
+ if (m_showProgress) {
+ m_statusBar->setProgressText(i18n("Loading folder..."));
+ m_statusBar->setProgress(0);
}
- } else {
- // no destination exists, hence just move the file to
- // do the renaming
- ok = KIO::NetAccess::file_move(source, dest);
}
- const QString destFileName = dest.fileName();
- if (ok) {
- m_statusBar->setMessage(i18n("Renamed file '%1' to '%2'.", source.fileName(), destFileName),
- DolphinStatusBar::OperationCompleted);
-
- KonqOperations::rename(this, source, destFileName);
- } else {
- m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.", source.fileName(), destFileName),
- DolphinStatusBar::Error);
- }
-}
-
-DolphinMainWindow* DolphinViewContainer::mainWindow() const
-{
- return m_mainWindow;
-}
-
-void DolphinViewContainer::updateProgress(int percent)
-{
if (m_showProgress) {
m_statusBar->setProgress(percent);
}
updateStatusBar();
- QTimer::singleShot(0, this, SLOT(restoreContentsPos()));
+ QTimer::singleShot(100, this, SLOT(restoreContentsPos()));
+}
+
+void DolphinViewContainer::showItemInfo(const KUrl& url)
+{
+ if (url.isEmpty()) {
+ m_statusBar->clear();
+ return;
+ }
+
+ const QModelIndex index = m_dirModel->indexForUrl(url);
+ const KFileItem* item = m_dirModel->itemForIndex(index);
+ if (item != 0) {
+ m_statusBar->setMessage(item->getStatusBarInfo(), DolphinStatusBar::Default);
+ }
}
void DolphinViewContainer::showInfoMessage(const QString& msg)
contextMenu.open();
}
+void DolphinViewContainer::saveContentsPos(int x, int y)
+{
+ m_urlNavigator->savePosition(x, y);
+}
+
+void DolphinViewContainer::restoreContentsPos()
+{
+ if (!url().isEmpty()) {
+ const QPoint pos = m_urlNavigator->savedPosition();
+ m_view->setContentsPosition(pos.x(), pos.y());
+ }
+}
+
+void DolphinViewContainer::activate()
+{
+ setActive(true);
+}
+
#include "dolphinviewcontainer.moc"