summaryrefslogtreecommitdiffstats
path: root/kcontrol/background/bgdialog.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2022-07-16 14:35:39 +0900
committerMavridis Philippe <[email protected]>2022-07-17 14:44:44 +0300
commit14bc816be9c921a6b004e0b0419e0c4c2f010b8c (patch)
tree83af2c09a0b99e564f8577b01e283de2ced7a0b7 /kcontrol/background/bgdialog.cpp
parentd6db1a583cc495ae318872e298f200ee1da673d9 (diff)
downloadtdebase-14bc816be9c921a6b004e0b0419e0c4c2f010b8c.tar.gz
tdebase-14bc816be9c921a6b004e0b0419e0c4c2f010b8c.zip
Use Scale & Crop as default style for wallpaper.
Add more options to "Set as Background" menu in Konqueror. This resolves issue #280 and issue #281. Signed-off-by: Michele Calgaro <[email protected]> Signed-off-by: Mavridis Philippe <[email protected]>
Diffstat (limited to 'kcontrol/background/bgdialog.cpp')
-rw-r--r--kcontrol/background/bgdialog.cpp54
1 files changed, 46 insertions, 8 deletions
diff --git a/kcontrol/background/bgdialog.cpp b/kcontrol/background/bgdialog.cpp
index 365713a06..67756d466 100644
--- a/kcontrol/background/bgdialog.cpp
+++ b/kcontrol/background/bgdialog.cpp
@@ -1,5 +1,4 @@
/*
-
This file is part of the KDE libraries
Copyright (c) 2005 David Saxton <[email protected]>
@@ -245,10 +244,36 @@ BGDialog::BGDialog(TQWidget* parent, TDEConfig* _config, bool _multidesktop)
m_slideShowRandom = KBackgroundSettings::InOrder;
// Wallpaper Position
+ m_prevWallpaperPos = KBackgroundSettings::ScaleAndCrop;
+ m_prevTilePos = KBackgroundSettings::Tiled;
+
m_wallpaperPos = eRenderer()->wallpaperMode();
if (m_wallpaperPos == KBackgroundSettings::NoWallpaper)
m_wallpaperPos = KBackgroundSettings::Centred; // Default
+ const TQString path = eRenderer()->wallpaper();
+ KFileMetaInfo metaInfo(path);
+ if (metaInfo.isValid() && metaInfo.item("Dimensions").isValid())
+ {
+ // If the image is greater than 800x600 default to using the user selected mode
+ // for a normal wallpaper, otherwise default to user selection for tiles.
+ TQSize s = metaInfo.item("Dimensions").value().toSize();
+ m_isTile = (s.width() < 800 || s.height() < 600);
+ if (m_isTile)
+ {
+ m_prevTilePos = m_wallpaperPos;
+ }
+ else
+ {
+ m_prevWallpaperPos = m_wallpaperPos;
+ }
+ }
+ else if (KMimeType::findByPath(path)->is("image/svg+xml"))
+ {
+ m_prevWallpaperPos = m_wallpaperPos;
+ }
+
+ // Restrictions
if (TDEGlobal::dirs()->isRestrictedResource("wallpaper"))
{
m_urlWallpaperButton->hide();
@@ -940,18 +965,22 @@ void BGDialog::slotWallpaperTypeChanged(int i)
KFileMetaInfo metaInfo(path);
if (metaInfo.isValid() && metaInfo.item("Dimensions").isValid())
{
- // If the image is greater than 800x600 default to using scaled mode,
- // otherwise default to tiled.
-
+ // If the image is greater than 800x600 default to using the user selected mode
+ // for a normal wallpaper, otherwise default to user selection for tiles.
TQSize s = metaInfo.item("Dimensions").value().toSize();
- if (s.width() >= 800 && s.height() >= 600)
- m_wallpaperPos = KBackgroundSettings::Scaled;
+ m_isTile = (s.width() < 800 || s.height() < 600);
+ if (m_isTile)
+ {
+ m_wallpaperPos = m_prevTilePos;
+ }
else
- m_wallpaperPos = KBackgroundSettings::Tiled;
+ {
+ m_wallpaperPos = m_prevWallpaperPos;
+ }
}
else if (KMimeType::findByPath(path)->is("image/svg+xml"))
{
- m_wallpaperPos = KBackgroundSettings::Scaled;
+ m_wallpaperPos = m_prevWallpaperPos;
}
r->setWallpaperMode(m_wallpaperPos);
@@ -998,6 +1027,15 @@ void BGDialog::slotWallpaperPos(int mode)
if (mode == r->wallpaperMode())
return;
+ if (m_isTile)
+ {
+ m_prevTilePos = mode;
+ }
+ else
+ {
+ m_prevWallpaperPos = mode;
+ }
+
r->stop();
r->setWallpaperMode(mode);
r->start(true);