|
@@ -51,6 +51,7 @@ void Fb2MainWindow::init()
|
|
noteEdit = NULL;
|
|
noteEdit = NULL;
|
|
qsciEdit = NULL;
|
|
qsciEdit = NULL;
|
|
treeView = NULL;
|
|
treeView = NULL;
|
|
|
|
+ headTree = NULL;
|
|
messageEdit = NULL;
|
|
messageEdit = NULL;
|
|
|
|
|
|
readSettings();
|
|
readSettings();
|
|
@@ -330,21 +331,27 @@ void Fb2MainWindow::createActions()
|
|
|
|
|
|
menu = menuBar()->addMenu(tr("&View"));
|
|
menu = menuBar()->addMenu(tr("&View"));
|
|
|
|
|
|
- QAction * actText = act = new QAction(tr("&Text"), this);
|
|
|
|
|
|
+ QActionGroup * viewGroup = new QActionGroup(this);
|
|
|
|
+
|
|
|
|
+ act = new QAction(tr("&Text"), this);
|
|
act->setCheckable(true);
|
|
act->setCheckable(true);
|
|
|
|
+ act->setChecked(true);
|
|
connect(act, SIGNAL(triggered()), this, SLOT(viewText()));
|
|
connect(act, SIGNAL(triggered()), this, SLOT(viewText()));
|
|
|
|
+ viewGroup->addAction(act);
|
|
|
|
+ menu->addAction(act);
|
|
|
|
|
|
- QAction * actQsci = act = new QAction(tr("&XML"), this);
|
|
|
|
|
|
+ act = new QAction(tr("&Head"), this);
|
|
act->setCheckable(true);
|
|
act->setCheckable(true);
|
|
- connect(act, SIGNAL(triggered()), this, SLOT(viewQsci()));
|
|
|
|
|
|
+ connect(act, SIGNAL(triggered()), this, SLOT(viewHead()));
|
|
|
|
+ viewGroup->addAction(act);
|
|
|
|
+ menu->addAction(act);
|
|
|
|
|
|
- QActionGroup * viewGroup = new QActionGroup(this);
|
|
|
|
- viewGroup->addAction(actText);
|
|
|
|
- viewGroup->addAction(actQsci);
|
|
|
|
- actText->setChecked(true);
|
|
|
|
|
|
+ act = new QAction(tr("&XML"), this);
|
|
|
|
+ act->setCheckable(true);
|
|
|
|
+ connect(act, SIGNAL(triggered()), this, SLOT(viewQsci()));
|
|
|
|
+ viewGroup->addAction(act);
|
|
|
|
+ menu->addAction(act);
|
|
|
|
|
|
- menu->addAction(actText);
|
|
|
|
- menu->addAction(actQsci);
|
|
|
|
menu->addSeparator();
|
|
menu->addSeparator();
|
|
|
|
|
|
tool = addToolBar(tr("Zoom"));
|
|
tool = addToolBar(tr("Zoom"));
|
|
@@ -558,8 +565,7 @@ bool Fb2MainWindow::saveFile(const QString &fileName)
|
|
QMessageBox::warning(this, qApp->applicationName(), tr("Cannot write file %1: %2.").arg(fileName).arg(file.errorString()));
|
|
QMessageBox::warning(this, qApp->applicationName(), tr("Cannot write file %1: %2.").arg(fileName).arg(file.errorString()));
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-
|
|
|
|
- if (textEdit) return textEdit->save(file);
|
|
|
|
|
|
+ if (textEdit) return textEdit->save(&file);
|
|
return true;
|
|
return true;
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -609,9 +615,9 @@ Fb2MainWindow *Fb2MainWindow::findFb2MainWindow(const QString &fileName)
|
|
void Fb2MainWindow::viewQsci()
|
|
void Fb2MainWindow::viewQsci()
|
|
{
|
|
{
|
|
if (centralWidget() == qsciEdit) return;
|
|
if (centralWidget() == qsciEdit) return;
|
|
- QString html;
|
|
|
|
|
|
+ QString xml;
|
|
if (textEdit) {
|
|
if (textEdit) {
|
|
- html = textEdit->toXml();
|
|
|
|
|
|
+ if (!textEdit->save(&xml)) return;
|
|
delete textEdit;
|
|
delete textEdit;
|
|
textEdit = NULL;
|
|
textEdit = NULL;
|
|
}
|
|
}
|
|
@@ -620,7 +626,7 @@ void Fb2MainWindow::viewQsci()
|
|
dockTree = NULL;
|
|
dockTree = NULL;
|
|
}
|
|
}
|
|
createQsci();
|
|
createQsci();
|
|
- qsciEdit->setText(html);
|
|
|
|
|
|
+ qsciEdit->setText(xml);
|
|
}
|
|
}
|
|
|
|
|
|
void Fb2MainWindow::viewText()
|
|
void Fb2MainWindow::viewText()
|
|
@@ -630,6 +636,10 @@ void Fb2MainWindow::viewText()
|
|
createText();
|
|
createText();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void Fb2MainWindow::viewHead()
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+
|
|
void Fb2MainWindow::clipboardDataChanged()
|
|
void Fb2MainWindow::clipboardDataChanged()
|
|
{
|
|
{
|
|
if (const QMimeData *md = QApplication::clipboard()->mimeData()) {
|
|
if (const QMimeData *md = QApplication::clipboard()->mimeData()) {
|