summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2022-07-16 14:35:39 +0900
committerMavridis Philippe <mavridisf@gmail.com>2022-07-17 14:44:44 +0300
commit14bc816be9c921a6b004e0b0419e0c4c2f010b8c (patch)
tree83af2c09a0b99e564f8577b01e283de2ced7a0b7
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 <michele.calgaro@yahoo.it> Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
-rw-r--r--kcontrol/background/bgdefaults.h4
-rw-r--r--kcontrol/background/bgdialog.cpp54
-rw-r--r--kcontrol/background/bgdialog.h7
-rw-r--r--kdesktop/kdesktopSetAsBackground.desktop38
-rw-r--r--kpersonalizer/keyecandypage.cpp2
-rw-r--r--tdmlib/kgreet_winbind.cpp2
6 files changed, 89 insertions, 18 deletions
diff --git a/kcontrol/background/bgdefaults.h b/kcontrol/background/bgdefaults.h
index bde81071a..e6ece1cfe 100644
--- a/kcontrol/background/bgdefaults.h
+++ b/kcontrol/background/bgdefaults.h
@@ -24,12 +24,10 @@
#define _defMinOptimizationDepth 1
// Per desktop defaults
-// Before you change this get in touch with me (kb9vqf@pearsoncomputing.net)
-// Thanks!!
#define _defColorA TQColor("#003082")
#define _defColorB TQColor("#C0C0C0")
#define _defBackgroundMode KBackgroundSettings::Flat
-#define _defWallpaperMode KBackgroundSettings::Scaled
+#define _defWallpaperMode KBackgroundSettings::ScaleAndCrop
#define _defMultiMode KBackgroundSettings::NoMulti
#define _defBlendMode KBackgroundSettings::NoBlending
#define _defBlendBalance 100
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 <david@bluehaze.org>
@@ -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);
diff --git a/kcontrol/background/bgdialog.h b/kcontrol/background/bgdialog.h
index 6b33d8999..607118337 100644
--- a/kcontrol/background/bgdialog.h
+++ b/kcontrol/background/bgdialog.h
@@ -99,8 +99,11 @@ protected:
TQValueVector< TQPtrVector<KBackgroundRenderer> > m_renderer; // m_renderer[desk][screen]
TQMap<TQString,int> m_wallpaper;
TQStringList m_patterns;
- int m_slideShowRandom; // Remembers last Slide Show setting
- int m_wallpaperPos; // Remembers last wallpaper pos
+ int m_slideShowRandom; // Remembers last Slide Show setting
+ int m_wallpaperPos; // Remembers last wallpaper pos
+ int m_prevWallpaperPos; // Previous normal wallpaper pos
+ int m_prevTilePos; // Previous tile wallpaper pos
+ bool m_isTile; // Whether the wallpaper is a tile (800x600 or smaller)
BGMonitorArrangement * m_pMonitorArrangement;
diff --git a/kdesktop/kdesktopSetAsBackground.desktop b/kdesktop/kdesktopSetAsBackground.desktop
index a7ba4f14a..3bc655803 100644
--- a/kdesktop/kdesktopSetAsBackground.desktop
+++ b/kdesktop/kdesktopSetAsBackground.desktop
@@ -1,14 +1,44 @@
[Desktop Entry]
X-TDE-ServiceTypes=image/*
-Actions=setAsBackground;tileAsBackground;
+Actions=centeredAsBackground;tiledAsBackground;centeredTiledAsBackground;centeredMaxpectAsBackground;tiledMaxpectAsBackground;scaledAsBackground;centeredAutoFitAsBackground;scaleAndCropAsBackground
X-TDE-Submenu=Set as Background
-[Desktop Action setAsBackground]
+[Desktop Action centeredAsBackground]
Name=Centered
Icon=background
-Exec=dcop kdesktop KBackgroundIface setWallpaper %u 6
+Exec=dcop kdesktop KBackgroundIface setWallpaper %u 1
-[Desktop Action tileAsBackground]
+[Desktop Action tiledAsBackground]
Name=Tiled
Icon=background
Exec=dcop kdesktop KBackgroundIface setWallpaper %u 2
+
+[Desktop Action centeredTiledAsBackground]
+Name=Center Tiled
+Icon=background
+Exec=dcop kdesktop KBackgroundIface setWallpaper %u 3
+
+[Desktop Action centeredMaxpectAsBackground]
+Name=Centered Maxpect
+Icon=background
+Exec=dcop kdesktop KBackgroundIface setWallpaper %u 4
+
+[Desktop Action tiledMaxpectAsBackground]
+Name=Tiled Maxpect
+Icon=background
+Exec=dcop kdesktop KBackgroundIface setWallpaper %u 5
+
+[Desktop Action scaledAsBackground]
+Name=Scaled
+Icon=background
+Exec=dcop kdesktop KBackgroundIface setWallpaper %u 6
+
+[Desktop Action centeredAutoFitAsBackground]
+Name=Centered Auto Fit
+Icon=background
+Exec=dcop kdesktop KBackgroundIface setWallpaper %u 7
+
+[Desktop Action scaleAndCropAsBackground]
+Name=Scale & Crop
+Icon=background
+Exec=dcop kdesktop KBackgroundIface setWallpaper %u 8
diff --git a/kpersonalizer/keyecandypage.cpp b/kpersonalizer/keyecandypage.cpp
index fb0f446d7..9c1fb7765 100644
--- a/kpersonalizer/keyecandypage.cpp
+++ b/kpersonalizer/keyecandypage.cpp
@@ -689,7 +689,7 @@ void KEyeCandyPage::getUserDefaults(){
st_UserWallpaper.CommonDesktop = kdesktopconf->readBoolEntry("CommonDesktop", true);
kdesktopconf->setGroup("Desktop0"); // we only need to set one desktop
st_UserWallpaper.MultiWallpaperMode = kdesktopconf->readEntry("MultiWallpaperMode", "NoMulti");
- st_UserWallpaper.WallpaperMode = kdesktopconf->readEntry("WallpaperMode", "Scaled");
+ st_UserWallpaper.WallpaperMode = kdesktopconf->readEntry("WallpaperMode", "ScaledAndCrop");
st_UserWallpaper.Wallpaper = kdesktopconf->readPathEntry("Wallpaper", "NoWallpaper");
deskbgimage = kdesktopconf->readPathEntry("Wallpaper", DEFAULT_WALLPAPER);
// Wallpaper-User-Defaults (END)
diff --git a/tdmlib/kgreet_winbind.cpp b/tdmlib/kgreet_winbind.cpp
index 471095d7e..545a96a61 100644
--- a/tdmlib/kgreet_winbind.cpp
+++ b/tdmlib/kgreet_winbind.cpp
@@ -91,8 +91,10 @@ KWinbindGreeter::KWinbindGreeter( KGreeterPluginHandler *_handler,
themer = 0;
if (!themer)
+ {
grid = new TQGridLayout( 0, 0, 10 );
layoutItem = TQT_TQLAYOUTITEM(grid);
+ }
domainLabel = loginLabel = passwdLabel = passwd1Label = passwd2Label = 0;
domainCombo = 0;