#ifndef MountieDialog_h
#define MountieDialog_h

#include <QtGui>
#include <QProcess>
#include "ui_mountie.h"
#include "ui_mounted.h"
#include "ui_unmounted.h"

class PrognameDialog;

// This is the main window for the applet (uses a top level dialog
// box, not a full blown main window widget).
//
class MountieDialog : public QDialog {
   Q_OBJECT

public:

   MountieDialog(QWidget * parent = 0);

   ~MountieDialog();

private slots:

   void
   BrowseButtonPushed();

   void
   MountpointChanged(const QString & text);

   void
   SelectionChanged();

   void
   TabChanged(int index);

   void
   DoIt();

   void
   ReadStdout();

   void
   ReadStderr();

   void
   CommandDone(int exitCode, QProcess::ExitStatus exitStatus);

   void
   RefreshTables();

   void
   SetStayOpen(bool checked);

   void
   SetKeepHistory(bool checked);

   void
   SetMountVia();

   void
   SaveFinalSize();

   void
   DoEject();

protected:

   virtual void
   contextMenuEvent(QContextMenuEvent *event);

private:

   void
   FiddleOKButton();

   void
   RunOneCommand(QString command, QStringList & args);

   void
   FiddleEjectAction();

   void
   CreateMenu();

   QStringList   prev_ejectable;

   Ui::Dialog    ui;
   Ui::Mounted   mounted;
   Ui::Unmounted unmounted;

   QFileDialog * dir_browser;

   QMenu * context_menu;
   QAction * refresh_action;
   QAction * stay_open_action;
   QAction * keep_history_action;
   QAction * mount_via_action;
   QAction * exit_action;
   QAction * eject_action;

   QProcess proc;

   QString  stdout_accum;
   QString  stderr_accum;

   PrognameDialog * pd;

   QMovie * movie;
   QPixmap * pix;
};

#endif // MountieDialog_h
