|
@@ -130,7 +130,7 @@ void Fb2MainWindow::fileNew()
|
|
|
|
|
|
void Fb2MainWindow::fileOpen()
|
|
void Fb2MainWindow::fileOpen()
|
|
{
|
|
{
|
|
- QString filename = QFileDialog::getOpenFileName(this);
|
|
|
|
|
|
+ QString filename = QFileDialog::getOpenFileName(this, tr("Open file"), QString(), "Fiction book files (*.fb2)");
|
|
if (filename.isEmpty()) return;
|
|
if (filename.isEmpty()) return;
|
|
|
|
|
|
Fb2MainWindow * existing = findFb2MainWindow(filename);
|
|
Fb2MainWindow * existing = findFb2MainWindow(filename);
|
|
@@ -212,6 +212,7 @@ void Fb2MainWindow::createActions()
|
|
|
|
|
|
menu = menuBar()->addMenu(tr("&File"));
|
|
menu = menuBar()->addMenu(tr("&File"));
|
|
tool = addToolBar(tr("File"));
|
|
tool = addToolBar(tr("File"));
|
|
|
|
+ tool->setMovable(false);
|
|
|
|
|
|
act = new QAction(icon("document-new"), tr("&New"), this);
|
|
act = new QAction(icon("document-new"), tr("&New"), this);
|
|
act->setPriority(QAction::LowPriority);
|
|
act->setPriority(QAction::LowPriority);
|
|
@@ -257,6 +258,8 @@ void Fb2MainWindow::createActions()
|
|
|
|
|
|
menu = menuBar()->addMenu(tr("&Edit"));
|
|
menu = menuBar()->addMenu(tr("&Edit"));
|
|
tool = addToolBar(tr("Edit"));
|
|
tool = addToolBar(tr("Edit"));
|
|
|
|
+ tool->setMovable(false);
|
|
|
|
+ tool->addSeparator();
|
|
|
|
|
|
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
|
|
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
|
|
|
|
|
|
@@ -302,7 +305,7 @@ void Fb2MainWindow::createActions()
|
|
clipboardDataChanged();
|
|
clipboardDataChanged();
|
|
|
|
|
|
menu = menuBar()->addMenu(tr("Fo&rmat"));
|
|
menu = menuBar()->addMenu(tr("Fo&rmat"));
|
|
- tool = addToolBar(tr("Format"));
|
|
|
|
|
|
+ tool->addSeparator();
|
|
|
|
|
|
actionTextBold = act = new QAction(icon("format-text-bold"), tr("Bold"), this);
|
|
actionTextBold = act = new QAction(icon("format-text-bold"), tr("Bold"), this);
|
|
act->setShortcuts(QKeySequence::Bold);
|
|
act->setShortcuts(QKeySequence::Bold);
|
|
@@ -332,6 +335,7 @@ void Fb2MainWindow::createActions()
|
|
tool->addAction(act);
|
|
tool->addAction(act);
|
|
|
|
|
|
menu = menuBar()->addMenu(tr("&View"));
|
|
menu = menuBar()->addMenu(tr("&View"));
|
|
|
|
+ tool->addSeparator();
|
|
|
|
|
|
QActionGroup * viewGroup = new QActionGroup(this);
|
|
QActionGroup * viewGroup = new QActionGroup(this);
|
|
|
|
|
|
@@ -356,8 +360,6 @@ void Fb2MainWindow::createActions()
|
|
|
|
|
|
menu->addSeparator();
|
|
menu->addSeparator();
|
|
|
|
|
|
- tool = addToolBar(tr("Zoom"));
|
|
|
|
-
|
|
|
|
actionZoomIn = act = new QAction(icon("zoom-in"), tr("Zoom in"), this);
|
|
actionZoomIn = act = new QAction(icon("zoom-in"), tr("Zoom in"), this);
|
|
act->setShortcuts(QKeySequence::ZoomIn);
|
|
act->setShortcuts(QKeySequence::ZoomIn);
|
|
menu->addAction(act);
|
|
menu->addAction(act);
|
|
@@ -409,6 +411,7 @@ void Fb2MainWindow::createTree()
|
|
dockTree->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
|
dockTree->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
|
dockTree->setWidget(treeView);
|
|
dockTree->setWidget(treeView);
|
|
addDockWidget(Qt::LeftDockWidgetArea, dockTree);
|
|
addDockWidget(Qt::LeftDockWidgetArea, dockTree);
|
|
|
|
+ treeView->setFocus();
|
|
}
|
|
}
|
|
|
|
|
|
void Fb2MainWindow::createHead()
|
|
void Fb2MainWindow::createHead()
|
|
@@ -416,10 +419,10 @@ void Fb2MainWindow::createHead()
|
|
if (headTree) return;
|
|
if (headTree) return;
|
|
headTree = new QTreeView(this);
|
|
headTree = new QTreeView(this);
|
|
if (textEdit) {
|
|
if (textEdit) {
|
|
|
|
+ this->setFocus();
|
|
textEdit->setParent(NULL);
|
|
textEdit->setParent(NULL);
|
|
setCentralWidget(headTree);
|
|
setCentralWidget(headTree);
|
|
textEdit->setParent(this);
|
|
textEdit->setParent(this);
|
|
-
|
|
|
|
Fb2HeadModel *model = new Fb2HeadModel(*textEdit, treeView);
|
|
Fb2HeadModel *model = new Fb2HeadModel(*textEdit, treeView);
|
|
headTree->setModel(model);
|
|
headTree->setModel(model);
|
|
model->expand(headTree);
|
|
model->expand(headTree);
|