QWidget* KFontAction::createWidget(QWidget* parent) { qDebug() << "KFontAction::createWidget()"; #ifdef __GNUC__ #warning FIXME: items need to be converted #endif // This is the visual element on the screen. This method overrides // the KSelectAction one, preventing KSelectAction from creating its // regular KComboBox. QFontComboBox *cb = new QFontComboBox( parent ); cb->setFontFilters(d->fontFilters); qDebug() << "\tset=" << font(); // Do this before connecting the signal so that nothing will fire. cb->setCurrentFont( QFont( font().toLower() ) ); qDebug() << "\tspit back=" << cb->currentFont().family(); connect( cb, SIGNAL(currentFontChanged(QFont)), SLOT(_k_slotFontChanged(QFont)) ); cb->setMinimumWidth( cb->sizeHint().width() ); return cb; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); createStatusBar(); // Recent files for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActions[i] = new QAction(this); recentFileActions[i]->setVisible(false); connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); ui->menuFile->insertAction(ui->actionExit, recentFileActions[i]); } recentFilesSeparator = ui->menuFile->insertSeparator(ui->actionExit); printer = new QPrinter; printer->setFullPage(true); printer->setPaperSize(QPrinter::Letter); printer->setPageMargins(.5, .5, .5, .5, QPrinter::Inch); report = new Report(printer, this); view = new ReportView(report, this); preview = new QPrintPreviewWidget(printer, this); setCentralWidget(preview); preview->fitToWidth(); QFontComboBox* fontComboBox = new QFontComboBox; fontComboBox->setFontFilters(QFontComboBox::MonospacedFonts | QFontComboBox::ScalableFonts); fontComboBox->setCurrentFont(report->font().family()); ui->fontToolBar->insertWidget(ui->actionBold, fontComboBox); connect(fontComboBox, SIGNAL(currentFontChanged(QFont)), report, SLOT(setFont(QFont))); pageNumberComboBox = new QComboBox; ui->viewToolBar->insertWidget(ui->actionNextPage, pageNumberComboBox); connect(pageNumberComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentPageChanged(int))); const qreal zoomFactors[] = { 12.5, 25, 50, 100, 125, 150, 200, 400, 800 }; zoomComboBox = new QComboBox; for (unsigned int i = 0; i < sizeof(zoomFactors) / sizeof(*zoomFactors); ++i) { zoomComboBox->addItem(QString("%1%").arg(zoomFactors[i])); } zoomComboBox->setCurrentIndex(-1); ui->viewToolBar->insertWidget(ui->actionZoomOut, zoomComboBox); connect(zoomComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(zoomChanged(QString))); QActionGroup* orientationGroup = new QActionGroup(this); orientationGroup->addAction(ui->actionPortrait); orientationGroup->addAction(ui->actionLandscape); orientationChanged(report->orientation()); QActionGroup* heightGroup = new QActionGroup(this); heightGroup->addAction(ui->action6LPI); heightGroup->addAction(ui->action8LPI); heightGroup->addAction(ui->action9LPI); heightGroup->setDisabled(ui->actionStretchFont->isEnabled()); connect(ui->actionStretchFont, SIGNAL(toggled(bool)), heightGroup, SLOT(setDisabled(bool))); QActionGroup* widthGroup = new QActionGroup(this); widthGroup->addAction(ui->actionDefaultWidth); widthGroup->addAction(ui->action10CPI); widthGroup->addAction(ui->action12CPI); widthGroup->addAction(ui->action17CPI); widthGroup->setDisabled(ui->actionStretchFont->isEnabled()); connect(ui->actionStretchFont, SIGNAL(toggled(bool)), widthGroup, SLOT(setDisabled(bool))); QActionGroup* pageGroup = new QActionGroup(this); pageGroup->addAction(ui->actionSinglePage); pageGroup->addAction(ui->actionFacingPages); pageGroup->addAction(ui->actionAllPages); ui->actionSinglePage->setChecked(preview->viewMode() == QPrintPreviewWidget::SinglePageView); ui->actionFacingPages->setChecked(preview->viewMode() == QPrintPreviewWidget::FacingPagesView); ui->actionAllPages->setChecked(preview->viewMode() == QPrintPreviewWidget::AllPagesView); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open())); connect(ui->actionOpenURL, SIGNAL(triggered()), this, SLOT(openUrl())); connect(ui->actionReload, SIGNAL(triggered()), this, SLOT(reload())); connect(ui->actionSaveAsPDF, SIGNAL(triggered()), this, SLOT(saveAsPdf())); connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print())); connect(ui->actionPageSetup, SIGNAL(triggered()), this, SLOT(pageSetup())); connect(ui->actionEmail, SIGNAL(triggered()), this, SLOT(email())); connect(ui->actionCopy, SIGNAL(triggered()), this, SLOT(copy())); connect(ui->actionStretchFont, SIGNAL(toggled(bool)), report, SLOT(setStretchFont(bool))); connect(report, SIGNAL(stretchFontChanged(bool)), ui->actionStretchFont, SLOT(setChecked(bool))); connect(ui->actionBold, SIGNAL(toggled(bool)), report, SLOT(setBold(bool))); connect(ui->actionStripes, SIGNAL(toggled(bool)), report, SLOT(setStripes(bool))); connect(ui->actionStripeColor, SIGNAL(triggered()), this, SLOT(stripeColor())); connect(ui->actionColor, SIGNAL(triggered()), this, SLOT(fontColor())); connect(ui->action6LPI, SIGNAL(triggered()), this, SLOT(height6Lpi())); connect(ui->action8LPI, SIGNAL(triggered()), this, SLOT(height8Lpi())); connect(ui->action9LPI, SIGNAL(triggered()), this, SLOT(height9Lpi())); connect(ui->actionDefaultWidth, SIGNAL(toggled(bool)), this, SLOT(widthDefault())); connect(ui->action10CPI, SIGNAL(triggered()), this, SLOT(width10Cpi())); connect(ui->action12CPI, SIGNAL(triggered()), this, SLOT(width12Cpi())); connect(ui->action17CPI, SIGNAL(triggered()), this, SLOT(width17Cpi())); connect(ui->actionFirstPage, SIGNAL(triggered()), this, SLOT(firstPage())); connect(ui->actionPreviousPage, SIGNAL(triggered()), this, SLOT(previousPage())); connect(ui->actionNextPage, SIGNAL(triggered()), this, SLOT(nextPage())); connect(ui->actionLastPage, SIGNAL(triggered()), this, SLOT(lastPage())); connect(ui->actionFitWidth, SIGNAL(triggered()), preview, SLOT(fitToWidth())); connect(ui->actionFitHeight, SIGNAL(triggered()), preview, SLOT(fitInView())); connect(ui->actionPortrait, SIGNAL(triggered()), preview, SLOT(setPortraitOrientation())); connect(ui->actionLandscape, SIGNAL(triggered()), preview, SLOT(setLandscapeOrientation())); connect(ui->actionActualSize, SIGNAL(triggered()), this, SLOT(actualSize())); connect(ui->actionZoomIn, SIGNAL(triggered()), preview, SLOT(zoomIn())); connect(ui->actionZoomOut, SIGNAL(triggered()), preview, SLOT(zoomOut())); connect(ui->actionSinglePage, SIGNAL(triggered()), preview, SLOT(setSinglePageViewMode())); connect(ui->actionFacingPages, SIGNAL(triggered()), preview, SLOT(setFacingPagesViewMode())); connect(ui->actionAllPages, SIGNAL(triggered()), preview, SLOT(setAllPagesViewMode())); connect(ui->actionMainToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleMainToolbar(bool))); connect(ui->actionViewToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleViewToolbar(bool))); connect(ui->actionFontToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleFontToolbar(bool))); connect(ui->actionStatusBar, SIGNAL(triggered(bool)), this, SLOT(toggleStatusBar(bool))); connect(ui->menuToolbars, SIGNAL(aboutToShow()), this, SLOT(updateToolbarMenu())); connect(ui->menuView, SIGNAL(aboutToShow()), this, SLOT(updateToolbarMenu())); connect(preview, SIGNAL(previewChanged()), this, SLOT(previewChanged())); connect(preview, SIGNAL(paintRequested(QPrinter*)), this, SLOT(paint(QPrinter*))); connect(report, SIGNAL(loaded()), preview, SLOT(updatePreview())); connect(report, SIGNAL(changed()), preview, SLOT(updatePreview())); connect(report, SIGNAL(loaded()), this, SLOT(documentLoaded())); connect(report, SIGNAL(orientationChanged(QPrinter::Orientation)), this, SLOT(orientationChanged(QPrinter::Orientation))); connect(report, SIGNAL(lpiChanged(int)), this, SLOT(lpiChanged(int))); connect(report, SIGNAL(cpiChanged(int)), this, SLOT(cpiChanged(int))); connect(report, SIGNAL(boldChanged(bool)), ui->actionBold, SLOT(setChecked(bool))); connect(report, SIGNAL(fontChanged(QFont)), fontComboBox, SLOT(setCurrentFont(QFont))); QSettings settings; restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("state").toByteArray()); recentFiles = settings.value("recentFiles").toStringList(); currentFolder = settings.value("currentFolder").toString(); ui->statusBar->setVisible(settings.value("statusBar", true).toBool()); updateRecentFileActions(); zoomTimer = new QTimer(this); connect(zoomTimer, SIGNAL(timeout()), this, SLOT(updateZoom())); connect(preview, SIGNAL(previewChanged()), this, SLOT(updateZoom())); zoomTimer->start(1000); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { EdamProtocol *edam = EdamProtocol::GetInstance(); ui->setupUi(this); pdfCache * pdf = new pdfCache(this); CustomNetworkAccessManager *nm = new CustomNetworkAccessManager(ui->editor->page()->networkAccessManager(), this, pdf); edam->setCNAM(nm); ui->editor->page()->setNetworkAccessManager(nm); Speller::setSettings(new DBSpellSettings(this, ui->editor)); ui->editor->setContextMenuPolicy(Qt::CustomContextMenu); ui->editor->load(QUrl("qrc:///html/noteajax.html")); jsB = new jsBridge(this, pdf); jsB->setWebView(ui->editor); enmlWritter = new enml2(this); connect(ui->editor->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJSObject())); loaded = false; editingEnabled = false; tagsActions = new QActionGroup(this); newTag = new TagLabel(this); newTag->hide(); ui->tagsBar->addWidget(newTag); appIcon = QIcon(":img/hippo64.png"); trayIcon = NULL; bool sysTrayEnabled = sql::readSyncStatus("systemTray", true).toBool(); if (QSystemTrayIcon::isSystemTrayAvailable() && sysTrayEnabled) enableSystemTrayIcon(true); connect(edam, SIGNAL(AuthenticateFailed()), this, SLOT(authentificationFailed())); connect(edam, SIGNAL(syncFinished()), this, SLOT(syncFinished())); connect(edam, SIGNAL(syncStarted(int)), this, SLOT(syncStarted(int))); connect(edam, SIGNAL(noteGuidChanged(QString,QString)), this, SLOT(changeNoteGuid(QString,QString))); connect(ui->notebooks, SIGNAL(itemSelectionChanged()), this, SLOT(switchNotebook())); connect(ui->tags, SIGNAL(itemSelectionChanged()), this, SLOT(switchTag())); connect(ui->tags, SIGNAL(tagAdded(QString,QString)), this, SLOT(addTag(QString,QString))); connect(ui->tags, SIGNAL(tagsUpdated()), this, SLOT(updateTagsToolBar())); connect(ui->tags, SIGNAL(tagsUpdated()), this, SLOT(switchTag())); connect(ui->NotesList, SIGNAL(noteSwitched()), this, SLOT(switchNote())); connect(ui->action_Abaut, SIGNAL(triggered()), this, SLOT(loadAboutInfo())); connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(closeWindow())); connect(ui->actionNew_Note, SIGNAL(triggered()), this, SLOT(newNote())); connect(ui->actionSync, SIGNAL(triggered()), this, SLOT(sync())); connect(ui->noteTitle, SIGNAL(textEdited(QString)), this, SLOT(noteTitleChange(QString))); connect(ui->actionAccount_info, SIGNAL(triggered()), this, SLOT(showUserInfo())); connect(ui->editor->page(), SIGNAL(linkClicked(QUrl)), this, SLOT(openURL(QUrl))); connect(ui->editor->page(), SIGNAL(microFocusChanged()), this, SLOT(updateEditButtonsState())); connect(ui->editor, SIGNAL(selectionChanged()), this, SLOT(updateSelectionButtonsState())); connect(ui->editor->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); connect(ui->editor, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(editorContextMenuRequested(QPoint))); connect(ui->editor, SIGNAL(fileInserted(QString)), this, SLOT(insertFile(QString))); connect(ui->notebooks, SIGNAL(noteMoved(QString,QString)), this, SLOT(moveNote(QString,QString))); connect(ui->notebooks, SIGNAL(noteDeleted(QString)), this, SLOT(deleteNote(QString))); connect(ui->notebooks, SIGNAL(noteRestored(QString,QString)), this, SLOT(restoreNote(QString,QString))); connect(ui->NotesList, SIGNAL(noteDeleted(QString)), this, SLOT(deleteNote(QString))); connect(ui->NotesList, SIGNAL(noteRestored(QString)), this, SLOT(restoreNote(QString))); connect(ui->NotesList, SIGNAL(noteCreated()), this, SLOT(newNote())); connect(ui->NotesList, SIGNAL(reloaded()), this, SLOT(updateCurrentNoteName())); connect(ui->editButton, SIGNAL(toggled(bool)), this, SLOT(setEditable(bool))); connect(ui->actionDelete_Note, SIGNAL(triggered()), this, SLOT(deleteNote())); connect(ui->toolBox, SIGNAL(currentChanged(int)), this, SLOT(changeTab(int))); connect(ui->editor->page(), SIGNAL(linkHovered(QString,QString,QString)), this, SLOT(linkHovered(QString,QString,QString))); connect(jsB, SIGNAL(hintMessage(QString,int)), ui->statusbar, SLOT(showMessage(QString,int))); connect(jsB, SIGNAL(noteChanged(QString)), this, SLOT(updateTagsToolBar(QString))); connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->actionDelete_Note, SLOT(setEnabled(bool))); connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->editButton, SLOT(setEnabled(bool))); connect(jsB, SIGNAL(editingStarted(bool)), ui->editButton, SLOT(setChecked(bool))); connect(jsB, SIGNAL(titleUpdated(QString,QString)), this, SLOT(updateNoteTitle(QString,QString))); connect(jsB, SIGNAL(conflictAdded(qint64,QString,bool)), this, SLOT(addConflict(qint64,QString,bool))); connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionNote_Info, SLOT(setEnabled(bool))); connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionExport, SLOT(setEnabled(bool))); connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionPrint, SLOT(setEnabled(bool))); connect(ui->editor, SIGNAL(tagUpdated(QString,bool)), this, SLOT(updateTag(QString,bool))); connect(tagsActions, SIGNAL(triggered(QAction*)), this, SLOT(tagClicked(QAction*))); connect(newTag, SIGNAL(tagCreated(QString)), this, SLOT(createTag(QString))); connect(ui->actionKeep_only_this_Version, SIGNAL(triggered()), this, SLOT(keepThisVersion())); connect(ui->actionNote_Info, SIGNAL(triggered()), this, SLOT(showNoteInfo())); connect(ui->actionExport, SIGNAL(triggered()), this, SLOT(exportNote())); connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print())); connect(this, SIGNAL(titleChanged(QString,QString)), jsB, SIGNAL(titleChanged(QString,QString))); setWindowIcon(appIcon); setWindowTitle("Hippo Notes"); setTabOrder(ui->noteTitle, ui->editor); ui->notebooks->setSortingEnabled(true); ui->notebooks->sortByColumn(0, Qt::AscendingOrder); ui->editBar->setVisible(false); ui->mainToolBar->addAction(ui->actionNew_Note); ui->mainToolBar->addAction(ui->actionSync); QFontComboBox *font = new QFontComboBox(this); font->setDisabled(true); font->setFontFilters(QFontComboBox::ScalableFonts); font->setEditable(false); connect(this, SIGNAL(editButtonsStateChanged(bool)), font, SLOT(setEnabled(bool))); connect(this, SIGNAL(updateFont(QFont)), font, SLOT(setCurrentFont(QFont))); connect(font, SIGNAL(activated(QString)), this, SLOT(changeFont(QString))); ui->editBar->addWidget(font); QComboBox *fontSize = new QComboBox(this); fontSize->setDisabled(true); fontSize->setEditable(false); for (int i = 1; i <= 7; i++) fontSize->addItem(QString::number(i)); connect(this, SIGNAL(editButtonsStateChanged(bool)), fontSize, SLOT(setEnabled(bool))); connect(this, SIGNAL(updateFontSize(int)), fontSize, SLOT(setCurrentIndex(int))); connect(fontSize, SIGNAL(activated(QString)), this, SLOT(changeFontSize(QString))); ui->editBar->addWidget(fontSize); QAction *boldIco = ui->editor->pageAction(QWebPage::ToggleBold); boldIco->setIcon(QIcon::fromTheme("format-text-bold")); ui->editBar->addAction(boldIco); QAction *italicIco = ui->editor->pageAction(QWebPage::ToggleItalic); italicIco->setIcon(QIcon::fromTheme("format-text-italic")); ui->editBar->addAction(italicIco); QAction *underlineIco = ui->editor->pageAction(QWebPage::ToggleUnderline); underlineIco->setIcon(QIcon::fromTheme("format-text-underline")); ui->editBar->addAction(underlineIco); QAction *strikethroughIco = ui->editor->pageAction(QWebPage::ToggleStrikethrough); strikethroughIco->setIcon(QIcon::fromTheme("format-text-strikethrough")); ui->editBar->addAction(strikethroughIco); ui->editBar->addSeparator(); QAction *undoIco = ui->editor->pageAction(QWebPage::Undo); undoIco->setIcon(QIcon::fromTheme("edit-undo")); undoIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z)); ui->editBar->addAction(undoIco); ui->menu_Edit->addAction(undoIco); QAction *redoIco = ui->editor->pageAction(QWebPage::Redo); redoIco->setIcon(QIcon::fromTheme("edit-redo")); redoIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z)); ui->editBar->addAction(redoIco); ui->menu_Edit->addAction(redoIco); ui->editBar->addSeparator(); QAction *rformatIco = ui->editor->pageAction(QWebPage::RemoveFormat); rformatIco->setIcon(QIcon::fromTheme("edit-clear")); ui->editBar->addAction(rformatIco); ui->editBar->addSeparator(); QAction *leftIco = ui->editor->pageAction(QWebPage::AlignLeft); leftIco->setIcon(QIcon::fromTheme("format-justify-left")); ui->editBar->addAction(leftIco); QAction *centerIco = ui->editor->pageAction(QWebPage::AlignCenter); centerIco->setIcon(QIcon::fromTheme("format-justify-center")); ui->editBar->addAction(centerIco); QAction *rightIco = ui->editor->pageAction(QWebPage::AlignRight); rightIco->setIcon(QIcon::fromTheme("format-justify-right")); ui->editBar->addAction(rightIco); QAction *fillIco = ui->editor->pageAction(QWebPage::AlignJustified); fillIco->setIcon(QIcon::fromTheme("format-justify-fill")); ui->editBar->addAction(fillIco); ui->editBar->addSeparator(); QAction *indentIco = ui->editor->pageAction(QWebPage::Indent); indentIco->setIcon(QIcon::fromTheme("format-indent-more")); ui->editBar->addAction(indentIco); QAction *outdentIco = ui->editor->pageAction(QWebPage::Outdent); outdentIco->setIcon(QIcon::fromTheme("format-indent-less")); ui->editBar->addAction(outdentIco); QAction *superscriptIco = ui->editor->pageAction(QWebPage::ToggleSuperscript); superscriptIco->setIcon(QIcon::fromTheme("format-text-superscript")); ui->editBar->addAction(superscriptIco); QAction *subscriptIco = ui->editor->pageAction(QWebPage::ToggleSubscript); subscriptIco->setIcon(QIcon::fromTheme("format-text-subscript")); ui->editBar->addAction(subscriptIco); QAction *unorderedIco = ui->editor->pageAction(QWebPage::InsertUnorderedList); unorderedIco->setIcon(QIcon::fromTheme("format-list-unordered")); ui->editBar->addAction(unorderedIco); QAction *orderedIco = ui->editor->pageAction(QWebPage::InsertOrderedList); orderedIco->setIcon(QIcon::fromTheme("format-list-ordered")); ui->editBar->addAction(orderedIco); QAction *lineIco = new QAction("Insert horizontal line", this); lineIco->setIcon(QIcon::fromTheme("insert-horizontal-rule")); lineIco->setDisabled(true); connect(this, SIGNAL(editButtonsStateChanged(bool)), lineIco, SLOT(setEnabled(bool))); connect(lineIco, SIGNAL(triggered()), this, SLOT(insertHorizontalLine())); ui->editBar->addAction(lineIco); ui->menu_Edit->addSeparator(); QAction *cutIco = ui->editor->pageAction(QWebPage::Cut); cutIco->setIcon(QIcon::fromTheme("edit-cut")); cutIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X)); ui->menu_Edit->addAction(cutIco); QAction *copyIco = ui->editor->pageAction(QWebPage::Copy); copyIco->setIcon(QIcon::fromTheme("edit-copy")); copyIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); ui->menu_Edit->addAction(copyIco); QAction *pasteIco = ui->editor->pageAction(QWebPage::Paste); pasteIco->setIcon(QIcon::fromTheme("edit-paste")); pasteIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V)); ui->menu_Edit->addAction(pasteIco); QAction *pasteSpecialIco = ui->editor->pageAction(QWebPage::PasteAndMatchStyle); pasteSpecialIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V)); ui->menu_Edit->addAction(pasteSpecialIco); ui->menu_Edit->addSeparator(); QAction *insertUrlIco = new QAction("Create link", this); insertUrlIco->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); insertUrlIco->setDisabled(true); insertUrlIco->setIcon(QIcon::fromTheme("insert-link")); connect(this, SIGNAL(selectionButtonsStateChanged(bool)), insertUrlIco, SLOT(setDisabled(bool))); connect(insertUrlIco, SIGNAL(triggered()), this, SLOT(insertUrl())); ui->menu_Edit->addAction(insertUrlIco); QAction *todoIco = new QAction("Insert To-do Checkbox", this); todoIco->setIcon(QIcon::fromTheme("checkbox")); todoIco->setDisabled(true); connect(this, SIGNAL(editButtonsStateChanged(bool)), todoIco, SLOT(setEnabled(bool))); connect(todoIco, SIGNAL(triggered()), jsB, SIGNAL(insertToDo())); ui->menu_Edit->addAction(todoIco); QAction *insertImage = new QAction("Insert Image", this); insertImage->setIcon(QIcon::fromTheme("insert-image")); insertImage->setDisabled(true); connect(this, SIGNAL(editButtonsStateChanged(bool)), insertImage, SLOT(setEnabled(bool))); connect(insertImage, SIGNAL(triggered()), this, SLOT(insertImg())); ui->menu_Edit->addAction(insertImage); QAction *insertFile = new QAction("Insert File", this); insertFile->setDisabled(true); connect(this, SIGNAL(editButtonsStateChanged(bool)), insertFile, SLOT(setEnabled(bool))); connect(insertFile, SIGNAL(triggered()), this, SLOT(insertFile())); ui->menu_Edit->addAction(insertFile); QAction *encryptIco = new QAction("Encrypt Selected Text...", this); encryptIco->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_X)); encryptIco->setDisabled(true); encryptIco->setIcon(QIcon::fromTheme("document-edit-encrypt")); connect(this, SIGNAL(selectionButtonsStateChanged(bool)), encryptIco, SLOT(setDisabled(bool))); connect(encryptIco, SIGNAL(triggered()), jsB, SIGNAL(encryptText())); ui->menu_Edit->addAction(encryptIco); ui->menu_Edit->addSeparator(); QAction *options = new QAction("&Options...", this); options->setIcon(QIcon::fromTheme("preferences-other")); connect(options, SIGNAL(triggered()), this, SLOT(showOptions())); ui->menu_Edit->addAction(options); clearConflictBar(); connect(jsB, SIGNAL(showConflict()), ui->conflictBar, SLOT(show())); connect(jsB, SIGNAL(showConflict()), ui->conflictBarBottom, SLOT(show())); conflictsGroup = new QActionGroup(this); connect(conflictsGroup, SIGNAL(triggered(QAction*)), this, SLOT(changeNoteVersion(QAction*))); searchIndex = new SearchIndex(this); connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(search())); connect(edam, SIGNAL(syncFinished()), searchIndex, SLOT(buildSearchIndex())); connect(jsB, SIGNAL(noteUpdated(QString)), searchIndex, SLOT(updateNoteIndex(QString))); connect(edam, SIGNAL(noteUpdated(QString)), searchIndex, SLOT(dropNoteIndex(QString))); connect(ui->searchInput, SIGNAL(returnPressed()), this, SLOT(search())); QByteArray mainWindowGeometry = sql::readSyncStatus("mainWindowGeometry").toString().toLatin1(); if (!mainWindowGeometry.isEmpty()) restoreGeometry(QByteArray::fromBase64(mainWindowGeometry)); QByteArray mainWidgetsSplitterState = sql::readSyncStatus("mainWidgetsSplitterState").toString().toLatin1(); if (!mainWidgetsSplitterState.isEmpty()) ui->mainWidgetsSplitter->restoreState(QByteArray::fromBase64(mainWidgetsSplitterState)); //showWindow(); edam->init(); }