#include <kio/previewjob.h>
#include <kjob.h>
#include <kmenu.h>
+#include <kmessagebox.h>
#include <kmimetyperesolver.h>
#include <konq_operations.h>
#include <konqmimedata.h>
m_topLayout->setSpacing(0);
m_topLayout->setMargin(0);
- connect(m_dirLister, SIGNAL(completed()),
- this, SLOT(updateCutItems()));
-
m_controller = new DolphinController(this);
m_controller->setUrl(url);
m_iconManager->setShowPreview(show);
emit showPreviewChanged();
- loadDirectory(viewPropsUrl, true);
+ loadDirectory(viewPropsUrl);
}
bool DolphinView::showPreview() const
m_dirLister->setShowingDotFiles(show);
emit showHiddenFilesChanged();
- loadDirectory(viewPropsUrl, true);
+ loadDirectory(viewPropsUrl);
}
bool DolphinView::showHiddenFiles() const
void DolphinView::zoomIn()
{
m_controller->triggerZoomIn();
- reload();
+ m_iconManager->updatePreviews();
}
void DolphinView::zoomOut()
{
m_controller->triggerZoomOut();
- reload();
+ m_iconManager->updatePreviews();
}
bool DolphinView::isZoomInPossible() const
if (itemView() != m_detailsView) {
// the details view requires no reloading of the directory, as it maps
// the file item delegate info to its columns internally
- loadDirectory(viewPropsUrl, true);
+ loadDirectory(viewPropsUrl);
}
}
void DolphinView::wheelEvent(QWheelEvent* event)
{
- if ((event->modifiers() & Qt::ControlModifier) == Qt::ControlModifier) {
- int d = event->delta();
- if (d > 0 && isZoomInPossible()) {
+ if (event->modifiers() & Qt::ControlModifier) {
+ const int delta = event->delta();
+ if ((delta > 0) && isZoomInPossible()) {
zoomIn();
- } else if (d < 0 && isZoomOutPossible()) {
+ } else if ((delta < 0) && isZoomOutPossible()) {
zoomOut();
}
- event->accept();
+ event->accept();
}
}
+bool DolphinView::eventFilter(QObject* watched, QEvent* event)
+{
+ if ((watched == itemView()) && (event->type() == QEvent::FocusIn)) {
+ m_controller->requestActivation();
+ }
+
+ return QWidget::eventFilter(watched, event);
+}
+
void DolphinView::activate()
{
setActive(true);
void DolphinView::showHoverInformation(const KFileItem& item)
{
- if (hasSelection() || !m_active) {
- return;
- }
-
emit requestItemInfo(item);
}
void DolphinView::clearHoverInformation()
{
- if (m_active) {
- emit requestItemInfo(KFileItem());
- }
+ emit requestItemInfo(KFileItem());
}
void DolphinView::createView()
}
Q_ASSERT(view != 0);
+ view->installEventFilter(this);
+
+ m_controller->setItemView(view);
m_fileItemDelegate = new KFileItemDelegate(view);
view->setItemDelegate(m_fileItemDelegate);
}
}
}
+ } else if (DolphinSettings::instance().generalSettings()->renameInline()) {
+ Q_ASSERT(items.count() == 1);
+
+ if (isColumnViewActive()) {
+ m_columnView->editItem(items.first());
+ } else {
+ const QModelIndex dirIndex = m_dolphinModel->indexForItem(items.first());
+ const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
+ itemView()->edit(proxyIndex);
+ }
} else {
- // Only one item has been selected for renaming. Use the custom
- // renaming mechanism from the views.
Q_ASSERT(items.count() == 1);
- // TODO: Think about using KFileItemDelegate as soon as it supports editing.
- // Currently the RenameDialog is used, but I'm not sure whether inline renaming
- // is a benefit for the user at all -> let's wait for some input first...
RenameDialog dialog(this, items);
if (dialog.exec() == QDialog::Rejected) {
return;
const QMimeData* mimeData = clipboard->mimeData();
const KUrl::List sourceUrls = KUrl::List::fromMimeData(mimeData);
-
- // per default the pasting is done into the current Url of the view
- KUrl destUrl(url());
-
- // check whether the pasting should be done into a selected directory
- const KUrl::List selectedUrls = this->selectedUrls();
- if (selectedUrls.count() == 1) {
- const KFileItem fileItem(S_IFDIR,
- KFileItem::Unknown,
- selectedUrls.first(),
- true);
- if (fileItem.isDir()) {
- // only one item is selected which is a directory, hence paste
- // into this directory
- destUrl = selectedUrls.first();
- }
- }
-
if (KonqMimeData::decodeIsCutSelection(mimeData)) {
- KonqOperations::copy(this, KonqOperations::MOVE, sourceUrls, destUrl);
+ KonqOperations::copy(this, KonqOperations::MOVE, sourceUrls, url());
emit doingOperation(KonqFileUndoManager::MOVE);
clipboard->clear();
} else {
- KonqOperations::copy(this, KonqOperations::COPY, sourceUrls, destUrl);
+ KonqOperations::copy(this, KonqOperations::COPY, sourceUrls, url());
emit doingOperation(KonqFileUndoManager::COPY);
}
}
KUrl::List urls = KUrl::List::fromMimeData(mimeData);
if (!urls.isEmpty()) {
ret.first = true;
- ret.second = i18ncp("@action:inmenu", "Paste One File", "Paste %1 Files", urls.count());
+ if (urls.count() == 1) {
+ const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, urls.first(), true);
+ ret.second = item.isDir() ? i18nc("@action:inmenu", "Paste One Folder") :
+ i18nc("@action:inmenu", "Paste One File");
+
+ } else {
+ ret.second = i18ncp("@action:inmenu", "Paste One Item", "Paste %1 Items", urls.count());
+ }
} else {
ret.first = false;
ret.second = i18nc("@action:inmenu", "Paste");
}
- if (ret.first) {
- const KFileItemList items = selectedItems();
- const uint count = items.count();
- if (count > 1) {
- // pasting should not be allowed when more than one file
- // is selected
- ret.first = false;
- } else if (count == 1) {
- // Only one file is selected. Pasting is only allowed if this
- // file is a directory.
- ret.first = items.first().isDir();
- }
- }
return ret;
}