File: kerror.cpp

package info (click to toggle)
kdegraphics 2%3A980312-3
  • links: PTS
  • area: contrib
  • in suites: hamm
  • size: 6,168 kB
  • ctags: 5,778
  • sloc: ansic: 26,607; cpp: 21,205; sh: 5,224; makefile: 1,651; perl: 108
file content (86 lines) | stat: -rw-r--r-- 1,734 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

/*
	kview error handler class implementation.
	Sirtaj Singh Kang, March 1997.

	$Id: kerror.cpp,v 1.2 1997/04/23 20:18:13 kulow Exp $
*/

#include "kerror.moc"

#include<qapp.h>
#include<qdialog.h>
#include<qlabel.h>
#include<qpushbt.h>

class KViewMsgDlg : public QDialog
{
public:
	KViewMsgDlg(const char *msg=0, QWidget *parent=0, const char *name=0);
private:
	QPushButton	*bt;
	QLabel		*label;
};

KViewMsgDlg::KViewMsgDlg(const char *msg, QWidget *parent, const char *name)
	: QDialog(parent, name)
{

	bt = new QPushButton(this);
	bt->setText("Oops");

	label = new QLabel(this);

	label->move(10,10);
	label->setAutoResize(TRUE);
	label->setText(msg);
	
	resize(10+label->width()+10,
		10+label->height()+10+bt->height()+10);

	bt->move((width()-bt->width())/2, 20+label->height());

	setCaption("kview message");

	connect(bt, SIGNAL(clicked()), this, SLOT(accept()) );

	// move dialog to screen centre

	move( (qApp->desktop()->width()-width())/2,
		(qApp->desktop()->height()-height())/2);

}

const char *KViewError::errormsgs[] = {
        "Unknown Error",

        "kview couldn't find the file.",
	
	"kview was denied read access to the file.",

        "kview didn't recognize the image format.",

	"That's not a valid URL.",

	"kview couldn't recognize the remote file.",

        "kview is already performing an IO operation."
        "Wait for the job to finish, or cancel it.",
	"Couldn't run or connect to KFM.\n"
	"Wont be able to load internet files."
}; 

bool KViewError::message(Type err)
{
	KViewMsgDlg *dialog = new KViewMsgDlg(errormsgs[err]);
	
	dialog->show();

	return TRUE;
}

void KViewError::showMessage(Type err)
{
//	debug("%s:: showMessage called with %d.", className(), err);
	message(err);
}