Changeset View
Changeset View
Standalone View
Standalone View
src/Gui/KSMainWindow.cpp
Show First 20 Lines • Show All 119 Lines • ▼ Show 20 Line(s) | 115 | { | |||
---|---|---|---|---|---|
120 | setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); | 120 | setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); | ||
121 | 121 | | |||
122 | QPoint location = guiConfig.readEntry("window-position", QPoint(50, 50)); | 122 | QPoint location = guiConfig.readEntry("window-position", QPoint(50, 50)); | ||
123 | move(location); | 123 | move(location); | ||
124 | 124 | | |||
125 | // change window title on save and on autosave | 125 | // change window title on save and on autosave | ||
126 | 126 | | |||
127 | connect(ExportManager::instance(), &ExportManager::imageSaved, this, &KSMainWindow::imageSaved); | 127 | connect(ExportManager::instance(), &ExportManager::imageSaved, this, &KSMainWindow::imageSaved); | ||
128 | connect(ExportManager::instance(), &ExportManager::imageCopied, this, &KSMainWindow::imageCopied); | ||||
128 | connect(ExportManager::instance(), &ExportManager::imageSavedAndCopied, this, &KSMainWindow::imageSavedAndCopied); | 129 | connect(ExportManager::instance(), &ExportManager::imageSavedAndCopied, this, &KSMainWindow::imageSavedAndCopied); | ||
129 | 130 | | |||
130 | // the KSGWidget | 131 | // the KSGWidget | ||
131 | 132 | | |||
132 | connect(mKSWidget, &KSWidget::newScreenshotRequest, this, &KSMainWindow::captureScreenshot); | 133 | connect(mKSWidget, &KSWidget::newScreenshotRequest, this, &KSMainWindow::captureScreenshot); | ||
133 | connect(mKSWidget, &KSWidget::dragInitiated, this, &KSMainWindow::dragAndDropRequest); | 134 | connect(mKSWidget, &KSWidget::dragInitiated, this, &KSMainWindow::dragAndDropRequest); | ||
134 | 135 | | |||
135 | // the Button Bar | 136 | // the Button Bar | ||
Show All 11 Lines | 147 | mToolsButton->setIcon(QIcon::fromTheme(QStringLiteral("tools"), | |||
147 | QIcon::fromTheme(QStringLiteral("application-menu")))); | 148 | QIcon::fromTheme(QStringLiteral("application-menu")))); | ||
148 | mDialogButtonBox->addButton(mToolsButton, QDialogButtonBox::ActionRole); | 149 | mDialogButtonBox->addButton(mToolsButton, QDialogButtonBox::ActionRole); | ||
149 | mToolsButton->setMenu(mToolsMenu); | 150 | mToolsButton->setMenu(mToolsMenu); | ||
150 | 151 | | |||
151 | KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export"))); | 152 | KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export"))); | ||
152 | mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share"))); | 153 | mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share"))); | ||
153 | mDialogButtonBox->addButton(mSendToButton, QDialogButtonBox::ActionRole); | 154 | mDialogButtonBox->addButton(mSendToButton, QDialogButtonBox::ActionRole); | ||
154 | 155 | | |||
155 | mClipboardButton->setDefaultAction(KStandardAction::copy(this, SLOT(sendToClipboard()), this)); | 156 | mClipboardButton->setDefaultAction(KStandardAction::copy(ExportManager::instance(), &ExportManager::doCopyToClipboard, this)); | ||
156 | mClipboardButton->setText(i18n("Copy to Clipboard")); | 157 | mClipboardButton->setText(i18n("Copy to Clipboard")); | ||
157 | mClipboardButton->setToolTip(i18n("Copy the current screenshot image to the clipboard.")); | 158 | mClipboardButton->setToolTip(i18n("Copy the current screenshot image to the clipboard.")); | ||
158 | mClipboardButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | 159 | mClipboardButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | ||
159 | mDialogButtonBox->addButton(mClipboardButton, QDialogButtonBox::ActionRole); | 160 | mDialogButtonBox->addButton(mClipboardButton, QDialogButtonBox::ActionRole); | ||
160 | 161 | | |||
161 | mSaveButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | 162 | mSaveButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | ||
162 | mSaveButton->setMenu(mSaveMenu); | 163 | mSaveButton->setMenu(mSaveMenu); | ||
163 | mSaveButton->setPopupMode(QToolButton::MenuButtonPopup); | 164 | mSaveButton->setPopupMode(QToolButton::MenuButtonPopup); | ||
▲ Show 20 Lines • Show All 292 Lines • ▼ Show 20 Line(s) | 454 | } else { | |||
456 | } else { | 457 | } else { | ||
457 | showInlineMessage(i18n("The shared image link (<a href=\"%1\">%1</a>) has been copied to the clipboard.", message), | 458 | showInlineMessage(i18n("The shared image link (<a href=\"%1\">%1</a>) has been copied to the clipboard.", message), | ||
458 | KMessageWidget::Positive, MessageDuration::Persistent); | 459 | KMessageWidget::Positive, MessageDuration::Persistent); | ||
459 | QApplication::clipboard()->setText(message); | 460 | QApplication::clipboard()->setText(message); | ||
460 | } | 461 | } | ||
461 | } | 462 | } | ||
462 | } | 463 | } | ||
463 | 464 | | |||
464 | void KSMainWindow::sendToClipboard() | 465 | void KSMainWindow::imageCopied() | ||
465 | { | 466 | { | ||
466 | bool notify = false; | | |||
467 | ExportManager::instance()->doCopyToClipboard(notify); | | |||
468 | | ||||
469 | SpectacleConfig::instance()->quitAfterSaveOrCopyChecked() | 467 | SpectacleConfig::instance()->quitAfterSaveOrCopyChecked() | ||
470 | ? quit() | 468 | ? quit() | ||
471 | : showInlineMessage(i18n("The screenshot has been copied to the clipboard."), | 469 | : showInlineMessage(i18n("The screenshot has been copied to the clipboard."), | ||
472 | KMessageWidget::Information); | 470 | KMessageWidget::Information); | ||
473 | } | 471 | } | ||
474 | 472 | | |||
475 | void KSMainWindow::showPreferencesDialog() | 473 | void KSMainWindow::showPreferencesDialog() | ||
476 | { | 474 | { | ||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |