m_mode = mode;
- if (isColumnViewActive()) {
- // When changing the mode in the column view, it makes sense
- // to go back to the root URL of the column view automatically.
- // Otherwise there it would not be possible to turn off the column view
- // without focusing the first column.
- const KUrl root = rootUrl();
- setUrl(root);
- m_controller->setUrl(root);
- }
-
deleteView();
const KUrl viewPropsUrl = viewPropertiesUrl();
// additional information manually
const KFileItemDelegate::InformationList infoList = props.additionalInfo();
m_fileItemDelegate->setShowInformation(infoList);
- emit additionalInfoChanged(infoList);
+ emit additionalInfoChanged();
// Not all view modes support categorized sorting. Adjust the sorting model
// if changing the view mode results in a change of the categorized sorting
void DolphinView::zoomIn()
{
m_controller->triggerZoomIn();
+ reload();
}
void DolphinView::zoomOut()
{
m_controller->triggerZoomOut();
+ reload();
}
bool DolphinView::isZoomInPossible() const
props.setAdditionalInfo(info);
m_fileItemDelegate->setShowInformation(info);
- emit additionalInfoChanged(info);
+ emit additionalInfoChanged();
if (itemView() != m_detailsView) {
// the details view requires no reloading of the directory, as it maps
KFileItemDelegate::InformationList info = props.additionalInfo();
if (info != m_fileItemDelegate->showInformation()) {
m_fileItemDelegate->setShowInformation(info);
- emit additionalInfoChanged(info);
+ emit additionalInfoChanged();
}
const bool showPreview = props.showPreview();
m_fileItemDelegate->setShowInformation(info);
- emit additionalInfoChanged(info);
+ emit additionalInfoChanged();
+}
+
+void DolphinView::updateAdditionalInfoActions(KActionCollection* collection)
+{
+ const bool enable = (m_mode == DolphinView::DetailsView) ||
+ (m_mode == DolphinView::IconsView);
+
+ QAction* showSizeInfo = collection->action("show_size_info");
+ QAction* showDateInfo = collection->action("show_date_info");
+ QAction* showPermissionsInfo = collection->action("show_permissions_info");
+ QAction* showOwnerInfo = collection->action("show_owner_info");
+ QAction* showGroupInfo = collection->action("show_group_info");
+ QAction* showMimeInfo = collection->action("show_mime_info");
+
+ showSizeInfo->setChecked(false);
+ showDateInfo->setChecked(false);
+ showPermissionsInfo->setChecked(false);
+ showOwnerInfo->setChecked(false);
+ showGroupInfo->setChecked(false);
+ showMimeInfo->setChecked(false);
+
+ showSizeInfo->setEnabled(enable);
+ showDateInfo->setEnabled(enable);
+ showPermissionsInfo->setEnabled(enable);
+ showOwnerInfo->setEnabled(enable);
+ showGroupInfo->setEnabled(enable);
+ showMimeInfo->setEnabled(enable);
+
+ foreach (KFileItemDelegate::Information info, m_fileItemDelegate->showInformation()) {
+ switch (info) {
+ case KFileItemDelegate::Size:
+ showSizeInfo->setChecked(true);
+ break;
+ case KFileItemDelegate::ModificationTime:
+ showDateInfo->setChecked(true);
+ break;
+ case KFileItemDelegate::Permissions:
+ showPermissionsInfo->setChecked(true);
+ break;
+ case KFileItemDelegate::Owner:
+ showOwnerInfo->setChecked(true);
+ break;
+ case KFileItemDelegate::OwnerAndGroup:
+ showGroupInfo->setChecked(true);
+ break;
+ case KFileItemDelegate::FriendlyMimeType:
+ showMimeInfo->setChecked(true);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void DolphinView::toggleAdditionalInfo(QAction* action)
+{
+ const KFileItemDelegate::Information info =
+ static_cast<KFileItemDelegate::Information>(action->data().toInt());
+
+ KFileItemDelegate::InformationList list = additionalInfo();
+ const bool show = action->isChecked();
+
+ const int index = list.indexOf(info);
+ const bool containsInfo = (index >= 0);
+ if (show && !containsInfo) {
+ list.append(info);
+ setAdditionalInfo(list);
+ } else if (!show && containsInfo) {
+ list.removeAt(index);
+ setAdditionalInfo(list);
+ Q_ASSERT(list.indexOf(info) < 0);
+ }
}
void DolphinView::emitContentsMoved()
return ret;
}
-KAction* DolphinView::createRenameAction(KActionCollection* collection)
-{
- KAction* rename = collection->addAction("rename");
- rename->setText(i18nc("@action:inmenu File", "Rename..."));
- rename->setShortcut(Qt::Key_F2);
- return rename;
-}
-
-KAction* DolphinView::createMoveToTrashAction(KActionCollection* collection)
-{
- KAction* moveToTrash = collection->addAction("move_to_trash");
- moveToTrash->setText(i18nc("@action:inmenu File", "Move to Trash"));
- moveToTrash->setIcon(KIcon("user-trash"));
- moveToTrash->setShortcut(QKeySequence::Delete);
- return moveToTrash;
-}
-
-KAction* DolphinView::createDeleteAction(KActionCollection* collection)
-{
- KAction* deleteAction = collection->addAction("delete");
- deleteAction->setIcon(KIcon("edit-delete"));
- deleteAction->setText(i18nc("@action:inmenu File", "Delete"));
- deleteAction->setShortcut(Qt::SHIFT | Qt::Key_Delete);
- return deleteAction;
-}
-
-KAction* DolphinView::createNewDirAction(KActionCollection* collection)
-{
- // This action doesn't appear in the GUI, it's for the shortcut only.
- // KNewMenu takes care of the GUI stuff.
- KAction* newDirAction = collection->addAction("create_dir");
- newDirAction->setText(i18n("Create Folder..."));
- newDirAction->setShortcut(Qt::Key_F10);
- return newDirAction;
-}
-
-KAction* DolphinView::createSortDescendingAction(KActionCollection* collection)
-{
- KToggleAction* sortDescending = collection->add<KToggleAction>("descending");
- sortDescending->setText(i18nc("@action:inmenu Sort", "Descending"));
- return sortDescending;
-}
-
#include "dolphinview.moc"