warningdialog.cpp
author insilmaril
Mon Jul 23 12:42:01 2007 +0000 (2007-07-23)
changeset 557 7fc6541f0490
parent 432 f867269ab8a1
permissions -rw-r--r--
Added import filter for Freemind
insilmaril@388
     1
#include "warningdialog.h"
insilmaril@432
     2
#include "settings.h"
insilmaril@388
     3
insilmaril@388
     4
extern QString iconPath;
insilmaril@432
     5
extern Settings settings;
insilmaril@388
     6
insilmaril@388
     7
WarningDialog::WarningDialog(QWidget* parent):QDialog (parent)
insilmaril@388
     8
{
insilmaril@388
     9
    ui.setupUi(this);
insilmaril@414
    10
	//TODO proper icon for proceed needed
insilmaril@388
    11
	ui.okButton->setText(tr("Proceed"));
insilmaril@388
    12
	/*
insilmaril@388
    13
	ui.warningSign->setPixmap (QPixmap(iconPath + "icons/vym.png"));
insilmaril@432
    14
	*/
insilmaril@388
    15
	ui.showAgainBox->setText (tr("Show this message again"));
insilmaril@388
    16
	useShowAgain=false;
insilmaril@388
    17
	ui.showAgainBox->hide();
insilmaril@388
    18
}
insilmaril@388
    19
insilmaril@432
    20
int WarningDialog::exec()
insilmaril@432
    21
{
insilmaril@432
    22
	int result; 
insilmaril@432
    23
	if (settings.value ("/warningDialog/"+showAgainName+"/showAgain",true).toBool()  )
insilmaril@432
    24
	{
insilmaril@432
    25
		result=QDialog::exec();
insilmaril@432
    26
		if (result==QDialog::Accepted )
insilmaril@432
    27
		{
insilmaril@432
    28
			settings.setValue ("/warningDialog/"+showAgainName+"/value",result);
insilmaril@432
    29
			settings.setValue ("/warningDialog/"+showAgainName+"/showAgain",ui.showAgainBox->isChecked() );
insilmaril@432
    30
		}
insilmaril@432
    31
	} else
insilmaril@432
    32
	{
insilmaril@432
    33
		result=settings.value ("/warningDialog/"+showAgainName+"/value",0).toInt();
insilmaril@432
    34
	}
insilmaril@432
    35
	return result;
insilmaril@432
    36
}
insilmaril@432
    37
insilmaril@388
    38
void WarningDialog::showCancelButton (bool b)
insilmaril@388
    39
{
insilmaril@388
    40
	if (b)
insilmaril@388
    41
	{
insilmaril@388
    42
		ui.cancelButton->show();
insilmaril@388
    43
		ui.cancelButton->setText(tr("Cancel"));
insilmaril@388
    44
	} else
insilmaril@388
    45
		ui.cancelButton->hide();
insilmaril@388
    46
}
insilmaril@388
    47
insilmaril@443
    48
void WarningDialog::setShowAgainName (const QString &s) 
insilmaril@388
    49
{
insilmaril@388
    50
	showAgainName=s;
insilmaril@388
    51
	useShowAgain=true;
insilmaril@388
    52
	ui.showAgainBox->show();
insilmaril@388
    53
}
insilmaril@388
    54
insilmaril@388
    55
void WarningDialog::setText (const QString &s)
insilmaril@388
    56
{
insilmaril@388
    57
	ui.warningTE->setText(s);
insilmaril@388
    58
}
insilmaril@388
    59
insilmaril@388
    60
void WarningDialog::setCaption(const QString &s)
insilmaril@388
    61
{
insilmaril@430
    62
	QDialog::setCaption("VYM - "+s);
insilmaril@388
    63
}