summaryrefslogtreecommitdiffstats
path: root/ksquirrel/sq_errorstring.cpp
blob: dcbdb90fadfdc5138ac172db6bad23800827e98f (plain)
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
/***************************************************************************
                          sq_errorstring.cpp  -  description
                             -------------------
    begin                : ??? ??? 26 2005
    copyright            : (C) 2005 by Baryshev Dmitry
    email                : ksquirrel.iv@gmail.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "sq_errorstring.h"

#include <ksquirrel-libs/error.h>

SQ_ErrorString * SQ_ErrorString::m_instance = 0;

SQ_ErrorString::SQ_ErrorString(TQObject *tqparent) : TQObject(tqparent)
{
    m_instance = this;

    // fill map with translated messages
    messages.insert(SQE_OK,             TQString::tqfromLatin1("OK"));
    messages.insert(SQE_R_NOFILE,       i18n("cannot open file for reading"));
    messages.insert(SQE_R_BADFILE,      i18n("file corrupted"));
    messages.insert(SQE_R_NOMEMORY,     i18n("no memory"));
    messages.insert(SQE_R_NOTSUPPORTED, i18n("file type not supported"));
    messages.insert(SQE_R_WRONGDIM,     i18n("wrong image dimensions"));
    messages.insert(SQE_W_NOFILE,       i18n("cannot open file for writing"));
    messages.insert(SQE_W_NOTSUPPORTED, i18n("write feature is not supported"));
    messages.insert(SQE_W_ERROR,        i18n("write error (check free space)"));
    messages.insert(SQE_W_WRONGPARAMS,  i18n("wrong parameters"));
    messages.insert(SQE_NOTFINISHED,    i18n("Editing process is not finished yet"));
}

SQ_ErrorString::~SQ_ErrorString()
{}

// Get string by error code.
TQString SQ_ErrorString::string(const int code)
{
    return messages[code];
}

TQString SQ_ErrorString::stringSN(const int code)
{
    return messages[code] + '\n';
}