[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-i18n-doc
Subject: KDE/kdebase/workspace/plasma/generic/applets/devicenotifier
From: Jacopo De Simoi <wilderkde () gmail ! com>
Date: 2010-05-11 18:12:43
Message-ID: 20100511181243.DF15EAC8B2 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1125556 by jacopods:
Try to clarify if it is safe or unsafe to remove the device via tooltips.
I believe I can use some help with the wording. Help would be appreciated.
CCMAIL:kde-i18n-doc@kde.org
M +29 -4 deviceitem.cpp
M +17 -0 deviceitem.h
M +19 -0 notifierdialog.cpp
--- trunk/KDE/kdebase/workspace/plasma/generic/applets/devicenotifier/deviceitem.cpp \
#1125555:1125556 @@ -55,6 +55,7 @@
m_udi(udi),
m_hovered(false),
m_mounted(false),
+ m_safelyRemovable(true),
m_state(DeviceItem::Idle),
m_labelFade(0),
m_barFade(0),
@@ -266,17 +267,41 @@
return !(data(NotifierDialog::IsOpticalMedia).toBool() || \
data(NotifierDialog::IsEncryptedContainer).toBool()); }
-void DeviceItem::setMounted(const bool mounted)
+bool DeviceItem::safelyRemovable() const
{
- m_mounted = mounted;
+ return m_safelyRemovable;
+}
+
+void DeviceItem::setSafelyRemovable(const bool safe)
+{
+ if (m_safelyRemovable == safe) {
+ return;
+ }
+ m_safelyRemovable = safe;
+ updateTooltip();
+}
+
+void DeviceItem::updateTooltip()
+{
if (m_mounted) {
m_leftActionIcon->setToolTip(i18n("Click to safely remove this device from \
the computer."));
- m_deviceIcon->setToolTip(i18n("Device is plugged in and can be accessed by \
applications.")); + m_deviceIcon->setToolTip(i18n("Device is plugged in and \
the volume can be accessed by applications. It is not safe to remove this device.")); \
} else {
m_leftActionIcon->setToolTip(i18n("Click to access this device from other \
applications."));
- m_deviceIcon->setToolTip(i18n("Device is plugged in, but not mounted for \
access yet.")); + if (safelyRemovable()) {
+ m_deviceIcon->setToolTip(i18n("Device is plugged in and the volume is \
not mounted for access yet. The device can be safely removed.")); + } else {
+ m_deviceIcon->setToolTip(i18n("Device is plugged in and the volume is \
not mounted for access yet. Another volume is accessible on the same device, which \
cannot be safely removed.")); }
+ }
+}
+void DeviceItem::setMounted(const bool mounted)
+{
+ m_mounted = mounted;
+
+ updateTooltip();
+
if (data(NotifierDialog::IsEncryptedContainer).toBool()) {
if (m_mounted && m_leftAction != Lock) {
setLeftAction(Lock);
--- trunk/KDE/kdebase/workspace/plasma/generic/applets/devicenotifier/deviceitem.h \
#1125555:1125556 @@ -154,6 +154,18 @@
bool hovered() const;
/**
+ * Used to know if this item can be safely removed
+ * @return true if it can be safely removed
+ **/
+ bool safelyRemovable() const;
+
+ /**
+ * Indicates if this item can be safely removed
+ * @param safe true if it can be safely removed
+ **/
+ void setSafelyRemovable(const bool safe = true);
+
+ /**
* Indicates if the device is mounted
* @param mounted true if it is mounted
**/
@@ -262,6 +274,8 @@
bool allowsCapacityBar() const;
+ void updateTooltip();
+
///The icon of the device
QIcon m_icon;
@@ -283,6 +297,9 @@
///True if the device is mounted
bool m_mounted;
+ ///True if the device can be safely removed
+ bool m_safelyRemovable;
+
///The action the left icon will do if activated
LeftActions m_leftAction;
--- trunk/KDE/kdebase/workspace/plasma/generic/applets/devicenotifier/notifierdialog.cpp \
#1125555:1125556 @@ -401,6 +401,25 @@
void NotifierDialog::setMounted(bool mounted, const QString &udi)
{
DeviceItem *item = itemForUdi(udi);
+
+ if (mounted) {
+ QString parentUdi = Solid::Device(udi).parent().udi();
+ foreach (DeviceItem* sibling, itemsForParentUdi(parentUdi)) {
+ sibling->setSafelyRemovable(false);
+ }
+ } else {
+ bool safelyRemovable = true;
+ QString parentUdi = Solid::Device(udi).parent().udi();
+ foreach (DeviceItem* sibling, itemsForParentUdi(parentUdi)) {
+ if ((sibling->udi() != udi) && (sibling->isMounted())) {
+ safelyRemovable = false;
+ }
+ }
+ foreach (DeviceItem* sibling, itemsForParentUdi(parentUdi)) {
+ sibling->setSafelyRemovable(safelyRemovable);
+ }
+ }
+
item->setMounted(mounted);
updateFreeSpace(item);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic