#include <kglobalsettings.h>
#include <kfilemetainfo.h>
#include <kiconeffect.h>
+#include <kmenu.h>
#include <kseparator.h>
#include <kiconloader.h>
#include <QVBoxLayout>
#include "settings/dolphinsettings.h"
+#include "informationpaneldialog.h"
#include "metadatawidget.h"
#include "metatextlabel.h"
#include "phononwidget.h"
m_phononWidget(0),
m_metaDataWidget(0),
m_metaTextArea(0),
- m_metaTextLabel(0)
+ m_metaTextLabel(0),
+ m_dialog(0)
{
}
return Panel::eventFilter(obj, event);
}
+void InformationPanel::contextMenuEvent(QContextMenuEvent* event)
+{
+ Panel::contextMenuEvent(event);
+
+ KMenu popup(this);
+ popup.addAction(i18nc("@action:inmenu", "Configure..."));
+ if (popup.exec(QCursor::pos()) != 0) {
+ if (m_dialog == 0) {
+ m_dialog = new InformationPanelDialog(this);
+ m_dialog->setAttribute(Qt::WA_DeleteOnClose);
+ m_dialog->show();
+ } else {
+ m_dialog->raise();
+ }
+ }
+}
+
void InformationPanel::showItemInfo()
{
if (!isVisible()) {
void InformationPanel::slotFileRenamed(const QString& source, const QString& dest)
{
- if (m_shownUrl == KUrl(source)) {
- // the currently shown file has been renamed, hence update the item information
- // for the renamed file
- KFileItem item(KFileItem::Unknown, KFileItem::Unknown, KUrl(dest));
- requestDelayedItemInfo(item);
+ const KUrl sourceUrl = KUrl(source);
+
+ // Verify whether the renamed item is selected. If this is the case, the
+ // selection must be updated with the renamed item.
+ bool isSelected = false;
+ for (int i = m_selection.size() - 1; i >= 0; --i) {
+ if (m_selection[i].url() == sourceUrl) {
+ m_selection.removeAt(i);
+ isSelected = true;
+ break;
+ }
+ }
+
+ if ((m_shownUrl == sourceUrl) || isSelected) {
+ m_shownUrl = KUrl(dest);
+ m_fileItem = KFileItem(KFileItem::Unknown, KFileItem::Unknown, m_shownUrl);
+ if (isSelected) {
+ m_selection.append(m_fileItem);
+ }
+ showItemInfo();
}
}
if (m_shownUrl == KUrl(fileName)) {
// the currently shown item has been removed, show
// the parent directory as fallback
- m_shownUrl = url();
- showItemInfo();
+ reset();
break;
}
}
// has been unmounted. In this case no directory change will be
// done in Dolphin, but the Information Panel must be updated to
// indicate an invalid directory.
- m_shownUrl = url();
- showItemInfo();
+ reset();
}
}
}
}
m_metaTextLabel->add(i18nc("@label", "Total size:"), KIO::convertSize(totalSize));
+
+ delete m_phononWidget;
+ m_phononWidget = 0;
} else {
const KFileItem item = fileItem();
if (item.isDir()) {
m_nameLabel->setText(wrappedText);
}
+void InformationPanel::reset()
+{
+ m_selection.clear();
+ m_shownUrl = url();
+ m_fileItem = KFileItem();
+ showItemInfo();
+}
+
void InformationPanel::init()
{
const int spacing = KDialog::spacingHint();