File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -80,9 +80,12 @@ MenuDiskItem::MenuDiskItem(Solid::Device device, Popup *popup):
80
80
81
81
MenuDiskItem::~MenuDiskItem () = default ;
82
82
83
- void MenuDiskItem::setMountStatus (bool mounted )
83
+ void MenuDiskItem::setMountStatus ()
84
84
{
85
- mEjectButton ->setEnabled (mounted);
85
+ if (mDevice .isValid ())
86
+ {
87
+ mEjectButton ->setEnabled (mDevice .as <Solid::StorageAccess>()->isAccessible () || !opticalParent ().udi ().isEmpty ());
88
+ }
86
89
}
87
90
88
91
void MenuDiskItem::updateMountStatus ()
@@ -96,7 +99,7 @@ void MenuDiskItem::updateMountStatus()
96
99
mDiskButton ->setIcon (icon);
97
100
mDiskButton ->setText (mDevice .description ());
98
101
99
- setMountStatus (mDevice . as <Solid::StorageAccess>()-> isAccessible () || ! opticalParent (). udi (). isEmpty () );
102
+ setMountStatus ();
100
103
}
101
104
else
102
105
emit invalid (mDevice .udi ());
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class MenuDiskItem : public QFrame
44
44
~MenuDiskItem ();
45
45
46
46
QString deviceUdi () const { return mDevice .udi (); }
47
- void setMountStatus (bool mounted );
47
+ void setMountStatus ();
48
48
49
49
private:
50
50
void updateMountStatus ();
Original file line number Diff line number Diff line change @@ -137,6 +137,20 @@ void Popup::onDeviceRemoved(QString const & udi)
137
137
138
138
void Popup::showEvent (QShowEvent *event)
139
139
{
140
+ // NOTE: This is a workaround for the lack of "Solid::StorageAccess::accessibilityChanged"
141
+ // when an encrypted volume is mounted by GLib/GIO.
142
+ const int size = layout ()->count () - 1 ;
143
+ for (int i = size; 0 <= i; --i)
144
+ {
145
+ QWidget *w = layout ()->itemAt (i)->widget ();
146
+ if (w == mPlaceholder )
147
+ continue ;
148
+ if (MenuDiskItem *it = static_cast <MenuDiskItem *>(w))
149
+ {
150
+ it->setMountStatus ();
151
+ }
152
+ }
153
+
140
154
mPlaceholder ->setVisible (mDisplayCount == 0 );
141
155
realign ();
142
156
setFocus ();
You can’t perform that action at this time.
0 commit comments