Changeset View
Changeset View
Standalone View
Standalone View
addons/filetree/katefiletree.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 54 | { | |||
---|---|---|---|---|---|
55 | setAcceptDrops(false); | 55 | setAcceptDrops(false); | ||
56 | setIndentation(12); | 56 | setIndentation(12); | ||
57 | setAllColumnsShowFocus(true); | 57 | setAllColumnsShowFocus(true); | ||
58 | setFocusPolicy(Qt::NoFocus); | 58 | setFocusPolicy(Qt::NoFocus); | ||
59 | setDragEnabled(true); | 59 | setDragEnabled(true); | ||
60 | setDragDropMode(QAbstractItemView::DragOnly); | 60 | setDragDropMode(QAbstractItemView::DragOnly); | ||
61 | 61 | | |||
62 | // handle activated (e.g. for pressing enter) + clicked (to avoid to need to do double-click e.g. on Windows) | 62 | // handle activated (e.g. for pressing enter) + clicked (to avoid to need to do double-click e.g. on Windows) | ||
63 | connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(mouseClicked(QModelIndex))); | 63 | connect(this, &KateFileTree::activated, this, &KateFileTree::mouseClicked); | ||
64 | connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(mouseClicked(QModelIndex))); | 64 | connect(this, &KateFileTree::clicked, this, &KateFileTree::mouseClicked); | ||
65 | connect(this, SIGNAL(pressed(QModelIndex)), this, SLOT(mouseClicked(QModelIndex))); | 65 | connect(this, &KateFileTree::pressed, this, &KateFileTree::mouseClicked); | ||
66 | 66 | | |||
67 | m_filelistReloadDocument = new QAction(QIcon::fromTheme(QLatin1String("view-refresh")), i18nc("@action:inmenu", "Reloa&d"), this); | 67 | m_filelistReloadDocument = new QAction(QIcon::fromTheme(QLatin1String("view-refresh")), i18nc("@action:inmenu", "Reloa&d"), this); | ||
68 | connect(m_filelistReloadDocument, SIGNAL(triggered(bool)), SLOT(slotDocumentReload())); | 68 | connect(m_filelistReloadDocument, &QAction::triggered, this, &KateFileTree::slotDocumentReload); | ||
69 | m_filelistReloadDocument->setWhatsThis(i18n("Reload selected document(s) from disk.")); | 69 | m_filelistReloadDocument->setWhatsThis(i18n("Reload selected document(s) from disk.")); | ||
70 | 70 | | |||
71 | m_filelistCloseDocument = new QAction(QIcon::fromTheme(QLatin1String("document-close")), i18nc("@action:inmenu", "Close"), this); | 71 | m_filelistCloseDocument = new QAction(QIcon::fromTheme(QLatin1String("document-close")), i18nc("@action:inmenu", "Close"), this); | ||
72 | connect(m_filelistCloseDocument, SIGNAL(triggered()), this, SLOT(slotDocumentClose())); | 72 | connect(m_filelistCloseDocument, &QAction::triggered, this, &KateFileTree::slotDocumentClose); | ||
73 | m_filelistCloseDocument->setWhatsThis(i18n("Close the current document.")); | 73 | m_filelistCloseDocument->setWhatsThis(i18n("Close the current document.")); | ||
74 | 74 | | |||
75 | m_filelistExpandRecursive = new QAction(QIcon::fromTheme(QLatin1String("view-list-tree")), i18nc("@action:inmenu", "Expand recursively"), this); | 75 | m_filelistExpandRecursive = new QAction(QIcon::fromTheme(QLatin1String("view-list-tree")), i18nc("@action:inmenu", "Expand recursively"), this); | ||
76 | connect(m_filelistExpandRecursive, SIGNAL(triggered()), this, SLOT(slotExpandRecursive())); | 76 | connect(m_filelistExpandRecursive, &QAction::triggered, this, &KateFileTree::slotExpandRecursive); | ||
77 | m_filelistExpandRecursive->setWhatsThis(i18n("Expand the file list sub tree recursively.")); | 77 | m_filelistExpandRecursive->setWhatsThis(i18n("Expand the file list sub tree recursively.")); | ||
78 | 78 | | |||
79 | m_filelistCollapseRecursive = new QAction(QIcon::fromTheme(QLatin1String("view-list-tree")), i18nc("@action:inmenu", "Collapse recursively"), this); | 79 | m_filelistCollapseRecursive = new QAction(QIcon::fromTheme(QLatin1String("view-list-tree")), i18nc("@action:inmenu", "Collapse recursively"), this); | ||
80 | connect(m_filelistCollapseRecursive, SIGNAL(triggered()), this, SLOT(slotCollapseRecursive())); | 80 | connect(m_filelistCollapseRecursive, &QAction::triggered, this, &KateFileTree::slotCollapseRecursive); | ||
81 | m_filelistCollapseRecursive->setWhatsThis(i18n("Collapse the file list sub tree recursively.")); | 81 | m_filelistCollapseRecursive->setWhatsThis(i18n("Collapse the file list sub tree recursively.")); | ||
82 | 82 | | |||
83 | m_filelistCloseOtherDocument = new QAction(QIcon::fromTheme(QLatin1String("document-close")), i18nc("@action:inmenu", "Close Other"), this); | 83 | m_filelistCloseOtherDocument = new QAction(QIcon::fromTheme(QLatin1String("document-close")), i18nc("@action:inmenu", "Close Other"), this); | ||
84 | connect(m_filelistCloseOtherDocument, SIGNAL(triggered()), this, SLOT(slotDocumentCloseOther())); | 84 | connect(m_filelistCloseOtherDocument, &QAction::triggered, this, &KateFileTree::slotDocumentCloseOther); | ||
85 | m_filelistCloseOtherDocument->setWhatsThis(i18n("Close other documents in this folder.")); | 85 | m_filelistCloseOtherDocument->setWhatsThis(i18n("Close other documents in this folder.")); | ||
86 | 86 | | |||
87 | m_filelistCopyFilename = new QAction(QIcon::fromTheme(QLatin1String("edit-copy")), i18nc("@action:inmenu", "Copy Filename"), this); | 87 | m_filelistCopyFilename = new QAction(QIcon::fromTheme(QLatin1String("edit-copy")), i18nc("@action:inmenu", "Copy Filename"), this); | ||
88 | connect(m_filelistCopyFilename, SIGNAL(triggered()), this, SLOT(slotCopyFilename())); | 88 | connect(m_filelistCopyFilename, &QAction::triggered, this, &KateFileTree::slotCopyFilename); | ||
89 | m_filelistCopyFilename->setWhatsThis(i18n("Copy the filename of the file.")); | 89 | m_filelistCopyFilename->setWhatsThis(i18n("Copy the filename of the file.")); | ||
90 | 90 | | |||
91 | m_filelistRenameFile = new QAction(QIcon::fromTheme(QLatin1String("edit-rename")), i18nc("@action:inmenu", "Rename File"), this); | 91 | m_filelistRenameFile = new QAction(QIcon::fromTheme(QLatin1String("edit-rename")), i18nc("@action:inmenu", "Rename File"), this); | ||
92 | connect(m_filelistRenameFile, &QAction::triggered, this, &KateFileTree::slotRenameFile); | 92 | connect(m_filelistRenameFile, &QAction::triggered, this, &KateFileTree::slotRenameFile); | ||
93 | m_filelistRenameFile->setWhatsThis(i18n("Rename the selected file.")); | 93 | m_filelistRenameFile->setWhatsThis(i18n("Rename the selected file.")); | ||
94 | 94 | | |||
95 | m_filelistPrintDocument = KStandardAction::print(this, SLOT(slotPrintDocument()), this); | 95 | m_filelistPrintDocument = KStandardAction::print(this, SLOT(slotPrintDocument()), this); | ||
96 | m_filelistPrintDocument->setWhatsThis(i18n("Print selected document.")); | 96 | m_filelistPrintDocument->setWhatsThis(i18n("Print selected document.")); | ||
97 | 97 | | |||
98 | m_filelistPrintDocumentPreview = KStandardAction::printPreview(this, SLOT(slotPrintDocumentPreview()), this); | 98 | m_filelistPrintDocumentPreview = KStandardAction::printPreview(this, SLOT(slotPrintDocumentPreview()), this); | ||
99 | m_filelistPrintDocumentPreview->setWhatsThis(i18n("Show print preview of current document")); | 99 | m_filelistPrintDocumentPreview->setWhatsThis(i18n("Show print preview of current document")); | ||
100 | 100 | | |||
101 | m_filelistDeleteDocument = new QAction(QIcon::fromTheme(QLatin1String("edit-delete-shred")), i18nc("@action:inmenu", "Delete Document"), this); | 101 | m_filelistDeleteDocument = new QAction(QIcon::fromTheme(QLatin1String("edit-delete-shred")), i18nc("@action:inmenu", "Delete Document"), this); | ||
102 | connect(m_filelistDeleteDocument, SIGNAL(triggered()), this, SLOT(slotDocumentDelete())); | 102 | connect(m_filelistDeleteDocument, &QAction::triggered, this, &KateFileTree::slotDocumentDelete); | ||
103 | m_filelistDeleteDocument->setWhatsThis(i18n("Close and delete selected file from storage.")); | 103 | m_filelistDeleteDocument->setWhatsThis(i18n("Close and delete selected file from storage.")); | ||
104 | 104 | | |||
105 | QActionGroup *modeGroup = new QActionGroup(this); | 105 | QActionGroup *modeGroup = new QActionGroup(this); | ||
106 | 106 | | |||
107 | m_treeModeAction = setupOption(modeGroup, QIcon::fromTheme(QLatin1String("view-list-tree")), i18nc("@action:inmenu", "Tree Mode"), | 107 | m_treeModeAction = setupOption(modeGroup, QIcon::fromTheme(QLatin1String("view-list-tree")), i18nc("@action:inmenu", "Tree Mode"), | ||
108 | i18n("Set view style to Tree Mode"), | 108 | i18n("Set view style to Tree Mode"), | ||
109 | SLOT(slotTreeMode()), true); | 109 | SLOT(slotTreeMode()), true); | ||
110 | 110 | | |||
Show All 11 Lines | 121 | m_sortByPath = setupOption(sortGroup, QIcon(), i18nc("@action:inmenu sorting option", "Document Path"), | |||
122 | i18n("Sort by Document Path"), | 122 | i18n("Sort by Document Path"), | ||
123 | SLOT(slotSortPath()), false); | 123 | SLOT(slotSortPath()), false); | ||
124 | 124 | | |||
125 | m_sortByOpeningOrder = setupOption(sortGroup, QIcon(), i18nc("@action:inmenu sorting option", "Opening Order"), | 125 | m_sortByOpeningOrder = setupOption(sortGroup, QIcon(), i18nc("@action:inmenu sorting option", "Opening Order"), | ||
126 | i18n("Sort by Opening Order"), | 126 | i18n("Sort by Opening Order"), | ||
127 | SLOT(slotSortOpeningOrder()), false); | 127 | SLOT(slotSortOpeningOrder()), false); | ||
128 | 128 | | |||
129 | m_resetHistory = new QAction(QIcon::fromTheme(QLatin1String("edit-clear-history")), i18nc("@action:inmenu", "Clear History"), this); | 129 | m_resetHistory = new QAction(QIcon::fromTheme(QLatin1String("edit-clear-history")), i18nc("@action:inmenu", "Clear History"), this); | ||
130 | connect(m_resetHistory, SIGNAL(triggered()), this, SLOT(slotResetHistory())); | 130 | connect(m_resetHistory, &QAction::triggered, this, &KateFileTree::slotResetHistory); | ||
131 | m_resetHistory->setWhatsThis(i18n("Clear edit/view history.")); | 131 | m_resetHistory->setWhatsThis(i18n("Clear edit/view history.")); | ||
132 | 132 | | |||
133 | QPalette p = palette(); | 133 | QPalette p = palette(); | ||
134 | p.setColor(QPalette::Inactive, QPalette::Highlight, p.color(QPalette::Active, QPalette::Highlight)); | 134 | p.setColor(QPalette::Inactive, QPalette::Highlight, p.color(QPalette::Active, QPalette::Highlight)); | ||
135 | p.setColor(QPalette::Inactive, QPalette::HighlightedText, p.color(QPalette::Active, QPalette::HighlightedText)); | 135 | p.setColor(QPalette::Inactive, QPalette::HighlightedText, p.color(QPalette::Active, QPalette::HighlightedText)); | ||
136 | setPalette(p); | 136 | setPalette(p); | ||
137 | } | 137 | } | ||
138 | 138 | | |||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Line(s) | 216 | { | |||
242 | if (isFile) { | 242 | if (isFile) { | ||
243 | menu.addAction(m_filelistCloseOtherDocument); | 243 | menu.addAction(m_filelistCloseOtherDocument); | ||
244 | menu.addSeparator(); | 244 | menu.addSeparator(); | ||
245 | menu.addAction(m_filelistCopyFilename); | 245 | menu.addAction(m_filelistCopyFilename); | ||
246 | menu.addAction(m_filelistRenameFile); | 246 | menu.addAction(m_filelistRenameFile); | ||
247 | menu.addAction(m_filelistPrintDocument); | 247 | menu.addAction(m_filelistPrintDocument); | ||
248 | menu.addAction(m_filelistPrintDocumentPreview); | 248 | menu.addAction(m_filelistPrintDocumentPreview); | ||
249 | QMenu *openWithMenu = menu.addMenu(i18nc("@action:inmenu", "Open With")); | 249 | QMenu *openWithMenu = menu.addMenu(i18nc("@action:inmenu", "Open With")); | ||
250 | connect(openWithMenu, SIGNAL(aboutToShow()), this, SLOT(slotFixOpenWithMenu())); | 250 | connect(openWithMenu, &QMenu::aboutToShow, this, &KateFileTree::slotFixOpenWithMenu); | ||
251 | connect(openWithMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenWithMenuAction(QAction *))); | 251 | connect(openWithMenu, &QMenu::triggered, this, &KateFileTree::slotOpenWithMenuAction); | ||
252 | 252 | | |||
253 | const bool hasFileName = doc->url().isValid(); | 253 | const bool hasFileName = doc->url().isValid(); | ||
254 | m_filelistCopyFilename->setEnabled(hasFileName); | 254 | m_filelistCopyFilename->setEnabled(hasFileName); | ||
255 | m_filelistRenameFile->setEnabled(hasFileName); | 255 | m_filelistRenameFile->setEnabled(hasFileName); | ||
256 | m_filelistDeleteDocument->setEnabled(hasFileName); | 256 | m_filelistDeleteDocument->setEnabled(hasFileName); | ||
257 | menu.addAction(m_filelistDeleteDocument); | 257 | menu.addAction(m_filelistDeleteDocument); | ||
258 | } | 258 | } | ||
259 | 259 | | |||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |