Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Spectacle
Commits
86d5227e
Verified
Commit
86d5227e
authored
Dec 07, 2021
by
Antonio Prcela
🏞
Browse files
Disable buttons that shouldn't be available when no screenshot was taken
BUG: 446578
parent
c8eedb63
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Gui/KSMainWindow.cpp
View file @
86d5227e
...
...
@@ -307,6 +307,7 @@ void KSMainWindow::setDefaultSaveAction()
mSaveButton
->
setDefaultAction
(
mSaveAction
);
break
;
}
mSaveButton
->
setEnabled
(
mPixmapExists
);
}
void
KSMainWindow
::
setDefaultCopyAction
()
...
...
@@ -321,6 +322,7 @@ void KSMainWindow::setDefaultCopyAction()
mClipboardButton
->
setDefaultAction
(
mClipboardLocationAction
);
break
;
}
mClipboardButton
->
setEnabled
(
mPixmapExists
);
}
// overrides
...
...
@@ -389,23 +391,30 @@ void KSMainWindow::captureScreenshot(Spectacle::CaptureMode theCaptureMode, int
void
KSMainWindow
::
setScreenshotAndShow
(
const
QPixmap
&
pixmap
)
{
if
(
!
pixmap
.
isNull
())
{
mPixmapExists
=
!
pixmap
.
isNull
();
if
(
mPixmapExists
)
{
mKSWidget
->
setScreenshotPixmap
(
pixmap
);
mExportMenu
->
imageUpdated
();
setWindowTitle
(
i18nc
(
"@title:window Unsaved Screenshot"
,
"Unsaved[*]"
));
setWindowModified
(
true
);
#ifdef KIMAGEANNOTATOR_FOUND
mAnnotateButton
->
setEnabled
(
true
);
#endif
}
else
{
restoreWindowTitle
();
}
#ifdef KIMAGEANNOTATOR_FOUND
mAnnotateButton
->
setEnabled
(
mPixmapExists
);
#endif
mToolsButton
->
setEnabled
(
mPixmapExists
);
mSendToButton
->
setEnabled
(
mPixmapExists
);
mClipboardButton
->
setEnabled
(
mPixmapExists
);
mSaveButton
->
setEnabled
(
mPixmapExists
);
mKSWidget
->
setButtonState
(
KSWidget
::
State
::
TakeNewScreenshot
);
show
();
activateWindow
();
/* NOTE windowWidth only produces the right result if it is called after the window is visible.
* Because of this the call is not moved into the if above */
if
(
!
p
ixmap
.
isNull
()
)
{
if
(
mP
ixmap
Exists
)
{
resize
(
QSize
(
windowWidth
(
pixmap
),
DEFAULT_WINDOW_HEIGHT
));
}
}
...
...
src/Gui/KSMainWindow.h
View file @
86d5227e
...
...
@@ -104,6 +104,7 @@ private:
Platform
::
ShutterModes
mShutterModes
;
QTimer
*
mHideMessageWidgetTimer
=
nullptr
;
QStackedLayout
*
mStack
=
nullptr
;
bool
mPixmapExists
=
false
;
#ifdef KIMAGEANNOTATOR_FOUND
QToolButton
*
const
mAnnotateButton
;
...
...
Antonio Prcela
🏞
@aprcela
mentioned in merge request
!132 (merged)
·
Apr 16, 2022
mentioned in merge request
!132 (merged)
mentioned in merge request !132
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment