source: src-qt4/pc-mounttray/menuItem.h @ db3bc52

releng/10.0.1releng/10.0.2releng/10.0.3
Last change on this file since db3bc52 was db3bc52, checked in by Ken Moore <ken@…>, 8 months ago

Adjust the mount tray unmounting routine to first unmount any additional nullfs mounts of the original mountpoint before unmounting the mountpoint. This still needs testing on 10.0 (since 10.x PBI's do the additional nullfs mounts).

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 Sub-classed widget for a fancy item selector
3*/
4
5#ifndef MENU_ITEM_H
6#define MENU_ITEM_H
7
8#include <QWidgetAction>
9#include <QDir>
10#include <QFile>
11#include <QPushButton>
12#include <QProgressBar>
13#include <QGridLayout>
14#include <QCheckBox>
15#include <QDebug>
16#include <QLabel>
17#include <QTimer>
18
19extern bool DEBUG_MODE;
20extern QString DEVICEDIR;
21extern QString MOUNTDIR;
22
23class MenuItem : public QWidgetAction
24{
25        Q_OBJECT
26
27  public:
28        MenuItem(QWidget* parent = 0, QString newdevice="", QString newlabel="", QString newtype="", QString newfs="", QString user="");
29        ~MenuItem();
30       
31        QString device;
32        QString devType;
33        QString filesystem;
34        QString mountpoint;
35        QString maxSize;  //number in KB saved as a QString
36        QString currentSize; //number in KB saved as a QString
37        QString AMFILE;
38        QString currentUser; //username of current user (for setting mount dir ownership)
39       
40        //Setters
41        void updateItem();
42        void mountItem(); //be careful calling this on it's own
43 
44        //Getters
45        QString getDeviceName();
46       
47        //Device information
48        bool isConnected();
49        bool isMounted();
50       
51        //Device Cleanup
52        void cleanup();
53       
54  private:
55        QWidget *frame;
56        QLabel* devLabel;
57        QLabel* devIcon;
58        QProgressBar* currentSpace;
59        QPushButton* pushMount;
60        QCheckBox* checkAutomount;
61
62        void unmountItem(bool force = false);
63        void updateSizes();
64        QString getSizeDisplay(int);
65        bool checkSavedAutoMount();
66        QStringList systemCMD(QString);
67 
68        bool umount(bool force, QString mntpoint);
69       
70  private slots:
71        void slotMountClicked();
72        void slotAutoMount();
73        void slotAutoMountToggled(bool);
74       
75  signals:
76        //Emits these signals whenever needed
77        void itemMounted(QString);      //device node (/dev/da*)
78        void itemUnmounted(QString);    //device node
79        void itemRemoved(QString);      //device node
80        void newMessage(QString, QString);      //message to be displayed
81
82};
83#endif
Note: See TracBrowser for help on using the repository browser.