summaryrefslogtreecommitdiff
path: root/kde-plasma/kdeplasma-addons/files/kdeplasma-addons-5.24.6-disable-actions-when-comic-is-not-ready.patch
blob: 0ce0db252c6aed83cf194a49e9abf5b334e052ab (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
From 352ecf9aa151e842f5304b8f4dc1fa7c7689b32f Mon Sep 17 00:00:00 2001
From: Nicolas Fella <nicolas.fella@gmx.de>
Date: Wed, 20 Jul 2022 15:00:02 +0200
Subject: [PATCH] [applets/comic] Disable most context menu actions when comic
 is not ready

This can be either because the loading failed or is not done yet

In those cases the actions don't make sense and can lead to crashes

BUG: 406991
(cherry picked from commit 6a0aec81074135c210a2ed11127ef9cfb138dbca)
---
 applets/comic/comic.cpp     | 3 +++
 applets/comic/comicdata.cpp | 1 +
 applets/comic/comicdata.h   | 6 ++++++
 3 files changed, 10 insertions(+)

diff --git a/applets/comic/comic.cpp b/applets/comic/comic.cpp
index 1ad3e83a4..b4f8154fa 100644
--- a/applets/comic/comic.cpp
+++ b/applets/comic/comic.cpp
@@ -495,6 +495,9 @@ void ComicApplet::updateContextMenu()
 {
     if (mCurrent.id().isEmpty()) {
         mActiveComicModel->clear();
+    }
+
+    if (mCurrent.id().isEmpty() || !mCurrent.ready()) {
         mActionNextNewStripTab->setEnabled(false);
         mActionGoFirst->setEnabled(false);
         mActionGoLast->setEnabled(false);
diff --git a/applets/comic/comicdata.cpp b/applets/comic/comicdata.cpp
index 52cc57e91..60eb475c9 100644
--- a/applets/comic/comicdata.cpp
+++ b/applets/comic/comicdata.cpp
@@ -62,6 +62,7 @@ void ComicData::setData(const Plasma::DataEngine::Data &data)
         mPrev = data[QStringLiteral("Previous identifier suffix")].toString();
         mNext = data[QStringLiteral("Next identifier suffix")].toString();
         mAdditionalText = data[QStringLiteral("Additional text")].toString();
+        mReady = true;
     }
 
     mWebsiteUrl = data[QStringLiteral("Website Url")].toUrl();
diff --git a/applets/comic/comicdata.h b/applets/comic/comicdata.h
index 9c884a291..b5f5ee3a7 100644
--- a/applets/comic/comicdata.h
+++ b/applets/comic/comicdata.h
@@ -190,6 +190,11 @@ public:
         return mMaxStripNum;
     }
 
+    bool ready() const
+    {
+        return mReady;
+    }
+
     void save();
 
 private:
@@ -226,6 +231,7 @@ private:
     bool mScaleComic = false;
     bool mIsLeftToRight = false;
     bool mIsTopToBottom = false;
+    bool mReady = false;
 
     KConfigGroup mCfg;
 };
-- 
GitLab