83
81
void CLexiconReadWindow::initActions() {
84
qDebug() << "CLexiconReadWindow::initActions";
86
82
BtActionCollection* ac = actionCollection();
87
83
CReadWindow::initActions();
88
84
CLexiconReadWindow::insertKeyboardActions(ac);
90
m_actions.backInHistory = dynamic_cast<BtToolBarPopupAction*>(
91
ac->action(CResMgr::displaywindows::general::backInHistory::actionName) );
86
QAction *qaction = ac->action(CResMgr::displaywindows::general::backInHistory::actionName);
87
Q_ASSERT(qaction != 0);
88
m_actions.backInHistory = dynamic_cast<BtToolBarPopupAction*>(qaction);
92
89
Q_ASSERT(m_actions.backInHistory);
93
90
addAction(m_actions.backInHistory);
95
m_actions.forwardInHistory = dynamic_cast<BtToolBarPopupAction*>(
96
ac->action(CResMgr::displaywindows::general::forwardInHistory::actionName) );
92
qaction = ac->action(CResMgr::displaywindows::general::forwardInHistory::actionName);
93
Q_ASSERT(qaction != 0);
94
m_actions.forwardInHistory = dynamic_cast<BtToolBarPopupAction*>(qaction);
97
95
Q_ASSERT(m_actions.forwardInHistory);
98
96
addAction(m_actions.forwardInHistory);
102
98
qaction = ac->action("nextEntry");
103
QObject::connect(qaction, SIGNAL(triggered()), this, SLOT( nextEntry() ) );
99
Q_ASSERT(qaction != 0);
100
connect(qaction, SIGNAL(triggered()),
101
this, SLOT(nextEntry()));
104
102
addAction(qaction);
106
104
qaction = ac->action("previousEntry");
107
QObject::connect(qaction, SIGNAL(triggered()), this, SLOT( previousEntry() ) );
105
Q_ASSERT(qaction != 0);
106
connect(qaction, SIGNAL(triggered()),
107
this, SLOT(previousEntry()));
108
108
addAction(qaction);
110
110
m_actions.selectAll = ac->action("selectAll");
111
Q_ASSERT(m_actions.selectAll);
111
Q_ASSERT(m_actions.selectAll != 0);
113
113
m_actions.findText = ac->action("findText");
114
Q_ASSERT(m_actions.findText);
114
Q_ASSERT(m_actions.findText != 0);
116
116
m_actions.findStrongs = ac->action(CResMgr::displaywindows::general::findStrongs::actionName);
117
QObject::connect(m_actions.findStrongs, SIGNAL(triggered()), this, SLOT(openSearchStrongsDialog()) );
117
Q_ASSERT(m_actions.findStrongs != 0);
118
connect(m_actions.findStrongs, SIGNAL(triggered()),
119
this, SLOT(openSearchStrongsDialog()) );
118
120
addAction(m_actions.findStrongs);
120
122
m_actions.copy.reference = ac->action("copyReferenceOnly");
121
QObject::connect(m_actions.copy.reference, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAnchorOnly()) );
123
Q_ASSERT(m_actions.copy.reference != 0);
124
connect(m_actions.copy.reference, SIGNAL(triggered()),
125
displayWidget()->connectionsProxy(), SLOT(copyAnchorOnly()));
122
126
addAction(m_actions.copy.reference);
124
128
m_actions.copy.entry = ac->action("copyEntryWithText");
125
QObject::connect(m_actions.copy.entry, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAll()) );
129
Q_ASSERT(m_actions.copy.entry != 0);
130
connect(m_actions.copy.entry, SIGNAL(triggered()),
131
displayWidget()->connectionsProxy(), SLOT(copyAll()));
126
132
addAction(m_actions.copy.entry);
128
Q_ASSERT(ac->action("copySelectedText"));
129
134
m_actions.copy.selectedText = ac->action("copySelectedText");
135
Q_ASSERT(m_actions.copy.selectedText != 0);
131
137
m_actions.save.entryAsPlain = new QAction(tr("Entry as plain text"), ac );
132
QObject::connect(m_actions.save.entryAsPlain, SIGNAL(triggered()), this, SLOT(saveAsPlain()) );
138
connect(m_actions.save.entryAsPlain, SIGNAL(triggered()),
139
this, SLOT(saveAsPlain()));
133
140
addAction(m_actions.save.entryAsPlain);
135
142
m_actions.save.entryAsHTML = ac->action("saveHtml");
136
QObject::connect(m_actions.save.entryAsHTML, SIGNAL(triggered()), this, SLOT(saveAsHTML()));
143
Q_ASSERT(m_actions.save.entryAsHTML != 0);
144
connect(m_actions.save.entryAsHTML, SIGNAL(triggered()),
145
this, SLOT(saveAsHTML()));
137
146
addAction(m_actions.save.entryAsHTML);
139
148
m_actions.print.reference = ac->action("printReferenceOnly");
140
QObject::connect(m_actions.print.reference, SIGNAL(triggered()), this, SLOT(printAnchorWithText()));
149
Q_ASSERT(m_actions.print.reference != 0);
150
connect(m_actions.print.reference, SIGNAL(triggered()),
151
this, SLOT(printAnchorWithText()));
141
152
addAction(m_actions.print.reference);
143
154
m_actions.print.entry = ac->action("printEntryWithText");
144
QObject::connect(m_actions.print.entry, SIGNAL(triggered()), this, SLOT(printAll()));
155
Q_ASSERT(m_actions.print.entry != 0);
156
connect(m_actions.print.entry, SIGNAL(triggered()),
157
this, SLOT(printAll()));
145
158
addAction(m_actions.print.entry);
147
160
// init with the user defined settings
148
qDebug() << "call CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac); and end CLexiconReadWindow::initActions";
149
161
CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, ac);
152
164
/** No descriptions */
153
165
void CLexiconReadWindow::initConnections() {
154
qDebug() << "CLexiconReadWindow::initConnections";
155
166
Q_ASSERT(keyChooser());
157
168
connect(keyChooser(), SIGNAL(keyChanged(CSwordKey*)), this, SLOT(lookupSwordKey(CSwordKey*)));
337
341
/** This function saves the entry as html using the CExportMgr class. */
338
342
void CLexiconReadWindow::saveAsHTML() {
339
CExportManager mgr(tr("Saving entry ..."), true, tr("Saving"), filterOptions(), displayOptions());
343
CExportManager mgr(true, tr("Saving"), filterOptions(), displayOptions());
340
344
mgr.saveKey(key(), CExportManager::HTML, true);
343
347
/** Saving the raw HTML for debugging purposes */
344
348
void CLexiconReadWindow::saveRawHTML() {
345
//qDebug() << "CLexiconReadWindow::saveRawHTML";
346
349
QString savefilename = QFileDialog::getSaveFileName();
347
350
if (savefilename.isEmpty()) return;
348
QFile file(savefilename);
349
351
BtHtmlReadDisplay* disp = dynamic_cast<BtHtmlReadDisplay*>(displayWidget());
353
QFile file(savefilename);
351
354
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
352
qDebug() << "could not open file";
355
qWarning() << "saveRawHTML: could not open file" << savefilename;
355
358
QString source = disp->getCurrentSource();
356
359
file.write(source.toUtf8());
357
//qDebug() << "wrote" << bytes << "bytes";
362
qDebug() << "No htmlreaddisplay widget!";
367
365
/** This function saves the entry as html using the CExportMgr class. */
368
366
void CLexiconReadWindow::saveAsPlain() {
369
CExportManager mgr(tr("Saving entry ..."), true, tr("Saving"), filterOptions(), displayOptions());
367
CExportManager mgr(true, tr("Saving"), filterOptions(), displayOptions());
370
368
mgr.saveKey(key(), CExportManager::Text, true);
373
371
void CLexiconReadWindow::slotFillBackHistory() {
374
qDebug() << "CLexiconReadWindow::slotFillBackHistory";
376
372
QMenu* menu = m_actions.backInHistory->popupMenu();