Debian Codegraph @

src/view/UserphraseViewMenu.cpp

raw symbols SCIP
1 /*
2 * chewing-editor: Chewing userphrase editor
3 * Copyright (C) 2014 Chewing Development Team
4
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include "UserphraseViewMenu.h"
21 #include "ui_UserphraseViewMenu.h"
22
23 UserphraseViewMenu::UserphraseViewMenu(QWidget *parent)
24 :QMenu{parent}
25 ,ui_{new Ui::UserphraseViewMenu}
26 {
27 ui_.get()->setupUi(this);
28 }
29
30 UserphraseViewMenu::~UserphraseViewMenu()
31 {
32 }
33
34 void UserphraseViewMenu::execWithSelectInfo(const QPoint &point, int selected)
35 {
36 switch (selected) {
37 case 0:
38 ui_.get()->actionModifyPhrase->setEnabled(false);
39 ui_.get()->actionRemovePhrase->setEnabled(false);
40 break;
41
42 case 1:
43 ui_.get()->actionModifyPhrase->setEnabled(true);
44 ui_.get()->actionRemovePhrase->setEnabled(true);
45 break;
46
47 default:
48 ui_.get()->actionModifyPhrase->setEnabled(false);
49 ui_.get()->actionRemovePhrase->setEnabled(true);
50 break;
51 }
52
53 exec(point);
54 }
55
56 QAction *UserphraseViewMenu::getActionAddPhrase()
57 {
58 return ui_.get()->actionAddPhrase;
59 }
60
61 QAction *UserphraseViewMenu::getActionModifyPhrase()
62 {
63 return ui_.get()->actionModifyPhrase;
64 }
65
66 QAction *UserphraseViewMenu::getActionRemovePhrase()
67 {
68 return ui_.get()->actionRemovePhrase;
69 }