void
OfflineBrief::setToggle (
        bool toggle)
{
    SYS_DEBUG ("toggle = %s", SYS_BOOL (toggle));
    /*
     * Don't do anything if we already in the desired mode
     */
    if (toggle && m_LastMode == QmDeviceMode::Flight)
        return;
    else if ((! toggle) && m_LastMode == QmDeviceMode::Normal)
        return;

#ifdef HAVE_QMSYSTEM
    if (! toggle)
    {
        MMessageBox* dialog =
                             //% "Exit offline mode?"
            new MMessageBox (qtTrId ("qtn_offl_exiting_title"),
                             //% "Connections will be restored."
                             qtTrId ("qtn_offl_exiting"),
                             M::YesButton | M::NoButton);
        /*
         * This will set the 'Normal' mode if dialog accepted
         */
        connect (dialog, SIGNAL (accepted ()),
                 SLOT (processDialogResult ()));
        /*
         * This will switch back the button for the proper state
         */
        connect (dialog, SIGNAL (rejected ()),
                 this, SIGNAL (valuesChanged ()));
        dialog->appear (MApplication::activeWindow (),
                        MSceneWindow::DestroyWhenDone);
    }
    else
    {
        bool success = m_DevMode->setMode (QmDeviceMode::Flight);
        SYS_DEBUG ("m_DevMode->setMode (Flight) success: %s", SYS_BOOL (success));
        if (success)
        {
            m_infoBanner = new MBanner;
            m_infoBanner->setStyleName ("InformationBanner");
            m_infoBanner->setObjectName ("InfoBanner");

            //% "Closing all connections. Switching to offline mode."
            m_infoBanner->setTitle (qtTrId ("qtn_offl_entering"));
            m_infoBanner->appear (
                MApplication::activeWindow (),
                MSceneWindow::DestroyWhenDone);
            // Set to NULL, as will destroy itself
            m_infoBanner = 0;
        }
    }
#endif
}
QString AppWindow::getItem(QString title, QString prompt, QStringList items)
{
	MWidget *centralWidget = new MWidget;
	QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
	centralWidget->setLayout(layout);

	MComboBox *combobox = new MComboBox(centralWidget);
	combobox->setTitle(prompt);
	combobox->addItems(items);

	layout->addItem(combobox);

	MDialog* dialog = new MDialog(title, M::OkButton | M::CancelButton);
	dialog->setCentralWidget(centralWidget);

	connect(dialog, SIGNAL(disappeared()), SLOT(processDialogResult()));
	if (dialog->exec(this) == M::OkButton)
		return combobox->currentText();
	return "";
}
QString AppWindow::getText(QString title, QString prompt, QString text)
{
	MWidget *centralWidget = new MWidget;
	QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
	centralWidget->setLayout(layout);

	MLabel *label = new MLabel(prompt, centralWidget);
	label->setStyleName("CommonTitleInverted");

	MTextEdit *textEdit = new MTextEdit(MTextEditModel::SingleLine, text, centralWidget);

	layout->addItem(label);
	layout->addItem(textEdit);

	MDialog* dialog = new MDialog(title, M::OkButton | M::CancelButton);
	dialog->setCentralWidget(centralWidget);

	connect(dialog, SIGNAL(disappeared()), SLOT(processDialogResult()));
	if (dialog->exec(this) == M::OkButton)
		return textEdit->text();
	return "";
}