2 * KFontInst - KDE Font Installer
4 * Copyright 2003-2007 Craig Drummond <craig@kde.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; see the file COPYING. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
24 #include "PreviewSelectAction.h"
25 #include "UnicodeBlocks.h"
26 #include "UnicodeScripts.h"
27 #include <KDE/KLocale>
32 CPreviewSelectAction::CPreviewSelectAction(QObject
*parent
, Mode mode
)
33 : KSelectAction(KIcon("character-set"), i18n("Preview Type"), parent
),
34 itsNumUnicodeBlocks(0)
38 connect(this, SIGNAL(triggered(int)), SLOT(selected(int)));
41 void CPreviewSelectAction::setStd()
47 void CPreviewSelectAction::setMode(Mode mode
)
51 items
.append(i18n("Standard Preview"));
52 items
.append(i18n("All Characters"));
59 case BlocksAndScripts
:
60 for(itsNumUnicodeBlocks
=0; constUnicodeBlocks
[itsNumUnicodeBlocks
].blockName
; ++itsNumUnicodeBlocks
)
61 items
.append(i18n("Unicode Block: %1", i18n(constUnicodeBlocks
[itsNumUnicodeBlocks
].blockName
)));
63 for(int i
=0; constUnicodeScriptList
[i
]; ++i
)
64 items
.append(i18n("Unicode Script: %1", i18n(constUnicodeScriptList
[i
])));
67 for(int i
=0; constUnicodeScriptList
[i
]; ++i
)
68 items
.append(i18n(constUnicodeScriptList
[i
]));
75 void CPreviewSelectAction::selected(int index
)
77 QList
<CFcEngine::TRange
> list
;
82 list
.append(CFcEngine::TRange());
83 else if(index
<itsNumUnicodeBlocks
+2)
84 list
.append(CFcEngine::TRange(constUnicodeBlocks
[index
-2].start
, constUnicodeBlocks
[index
-2].end
));
87 int script(index
-(2+itsNumUnicodeBlocks
));
89 for(int i
=0; constUnicodeScripts
[i
].scriptIndex
>=0; ++i
)
90 if(constUnicodeScripts
[i
].scriptIndex
==script
)
91 list
.append(CFcEngine::TRange(constUnicodeScripts
[i
].start
, constUnicodeScripts
[i
].end
));
99 #include "PreviewSelectAction.moc"