#ifndef _CONNECTIONDIALOG_H_ #define _CONNECTIONDIALOG_H_ #include //#include //#include class MainWindow; /** ConnectionDialog * Abstract base class for dialogs */ class ConnectionDialog : public Gtk::Window { public: ConnectionDialog(MainWindow* newParent, const Glib::ustring& title); ~ConnectionDialog(); protected: virtual void on_button_ok_click(); // callback for ok button virtual void on_button_cancel_click(); // callback for cancel button Gtk::VBox contentBox; // box containing the individual content of the dialogs Gtk::HBox buttonBox; // box containing the shared buttons (ok & cancel) of the dialogs Gtk::VBox windowBox; // box containing content and button boxes Gtk::Button buttonOK; // the ok button Gtk::Button buttonCancel; // the cancel button MainWindow* myParent; // pointer to the parenting window }; /** PasswordDialog * dialog with the sole purpose to ask for a password (if requested) */ class PasswordDialog : public ConnectionDialog { public: PasswordDialog(MainWindow* newParent, const Glib::ustring& title, QString* newTargetPW); // the PasswordDialog constructor takes a pointer to a string for the sole // reason that it is not connected to the connection that asks for a password and therefore cannot tell the user to which // connection it belongs. So the connection puts the hostname in the string which the pointer is pointing to for the password // dialog to read out and show to the user. The string is then overwritten with the password the user entered and then used // inside the connection to feed the password request. ~PasswordDialog(); protected: void on_enter_password(); void on_button_ok_click(); void on_button_cancel_click(); Gtk::Frame frameIP; Gtk::Entry entryPW; private: QString password, *targetPW; }; /** NewConDialog * dialog to open up a new connection to a vnc server * offers the options * * to enter a password to not come up * with a password dialog later * * to read prefab connections from a file */ class NewConDialog : public ConnectionDialog { public: NewConDialog(MainWindow* newParent, const Glib::ustring& title); ~NewConDialog(); protected: void on_enter_password(); // callback when enter was hit in the password text field. void on_enter_IP(); // callback when enter was hit in the IP/Host text field void on_button_ok_click(); // ok button callback void on_button_fromFile_click();// read-from-file button callback Gtk::Frame frameIP; // just a frame around the IP text field Gtk::Frame framePW; // the same for the pw field Gtk::Button buttonFromFile; // button to read out a file Gtk::Entry entryIP; // text field for the IP/Hostname Gtk::Entry entryPW; // text field for the password (optional) private: QString connection_password; QString connection_IP; }; class MessageDialog : public ConnectionDialog { public: MessageDialog(MainWindow* newParent, const Glib::ustring& title, QString* newMessage); ~MessageDialog(); protected: void on_enter_message(); // callback when enter was hit in the text field. void on_button_ok_click(); // ok button callback void on_button_fromFile_click();// read-from-file button callback Gtk::Frame frameMsg; // just a frame around the text Gtk::Entry entryMsg; // text field for the message private: QString * message; }; #endif