blob: 2167e75cbf18530cda3a13559672b1077dad8b5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
From f9de688e223be3b77268d36e237a838555d0f533 Mon Sep 17 00:00:00 2001
From: Michel Ludwig <michel.ludwig@kdemail.net>
Date: Sun, 28 Oct 2018 19:58:22 +0100
Subject: Search for the 'file_save_copy_as' action inside 'KTextEditor::View'
now
In that way, Kile doesn't crash after right-clicking on a view tab
BUG: 400191
---
src/kileviewmanager.cpp | 47 +++++++++++++++++++++++++++++------------------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/src/kileviewmanager.cpp b/src/kileviewmanager.cpp
index c0b8254..34f8439 100644
--- a/src/kileviewmanager.cpp
+++ b/src/kileviewmanager.cpp
@@ -506,39 +506,52 @@ void Manager::tabContext(const QPoint &pos)
// 'action1' can become null if it belongs to a view that has been closed, for example
QPointer<QAction> action1 = m_ki->mainWindow()->action("move_view_tab_left");
- action1->setData(qVariantFromValue(view));
- tabMenu.addAction(action1);
+ if(action1) {
+ action1->setData(qVariantFromValue(view));
+ tabMenu.addAction(action1);
+ }
QPointer<QAction> action2 = m_ki->mainWindow()->action("move_view_tab_right");
- action2->setData(qVariantFromValue(view));
- tabMenu.addAction(action2);
+ if(action2) {
+ action2->setData(qVariantFromValue(view));
+ tabMenu.addAction(action2);
+ }
tabMenu.addSeparator();
QPointer<QAction> action3;
if(view->document()->isModified()) {
action3 = view->actionCollection()->action(KStandardAction::name(KStandardAction::Save));
- action3->setData(qVariantFromValue(view));
- tabMenu.addAction(action3);
+ if(action3) {
+ action3->setData(qVariantFromValue(view));
+ tabMenu.addAction(action3);
+ }
}
QPointer<QAction> action4 = view->actionCollection()->action(KStandardAction::name(KStandardAction::SaveAs));
- action4->setData(qVariantFromValue(view));
- tabMenu.addAction(action4);
+ if(action4) {
+ action4->setData(qVariantFromValue(view));
+ tabMenu.addAction(action4);
+ }
- QPointer<QAction> action5 = m_ki->mainWindow()->action("file_save_copy_as");
- action5->setData(qVariantFromValue(view));
- tabMenu.addAction(action5);
+ QPointer<QAction> action5 = view->action("file_save_copy_as");
+ if(action5) {
+ tabMenu.addAction(action5);
+ }
tabMenu.addSeparator();
QPointer<QAction> action6 = m_ki->mainWindow()->action("file_close");
- action6->setData(qVariantFromValue(view));
- tabMenu.addAction(action6);
+ if(action6) {
+ action6->setData(qVariantFromValue(view));
+ tabMenu.addAction(action6);
+ }
QPointer<QAction> action7 = m_ki->mainWindow()->action("file_close_all_others");
- action7->setData(qVariantFromValue(view));
- tabMenu.addAction(action7);
+ if(action7) {
+ action7->setData(qVariantFromValue(view));
+ tabMenu.addAction(action7);
+ }
/*
FIXME create proper actions which delete/add the current file without asking stupidly
QAction* removeAction = m_ki->mainWindow()->action("project_remove");
@@ -562,9 +575,7 @@ void Manager::tabContext(const QPoint &pos)
if(action4) {
action4->setData(QVariant());
}
- if(action5) {
- action5->setData(QVariant());
- }
+ // action5 doesn't need to be given extra data
if(action6) {
action6->setData(QVariant());
}
--
cgit v1.1
|