WebPage::WebPage(QObject *parent) : QWebPage(parent) , loadProgress_(-1) { networkManagerProxy_ = new NetworkManagerProxy(this, this); setNetworkAccessManager(networkManagerProxy_); setPluginFactory(new WebPluginFactory(this)); setForwardUnsupportedContent(true); action(QWebPage::OpenFrameInNewWindow)->setVisible(false); action(QWebPage::OpenImageInNewWindow)->setVisible(false); connect(this, SIGNAL(loadProgress(int)), this, SLOT(progress(int))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(finished())); connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(handleUnsupportedContent(QNetworkReply*))); connect(this, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); connect(this, SIGNAL(printRequested(QWebFrame*)), mainApp->mainWindow(), SLOT(slotPrint(QWebFrame*))); livingPages_.append(this); }
WebView::WebView(QUrl baseUrl, QWidget *parent) : QWebView(parent), baseUrl_(baseUrl) { #ifdef Q_WS_X11 if (!core::system::getenv("KDE_FULL_SESSION").empty()) setStyle(new QPlastiqueStyle()); #endif setPage(new WebPage(baseUrl, this)); page()->setForwardUnsupportedContent(true); if (desktop::options().webkitDevTools()) page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); connect(page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); connect(page(), SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(unsupportedContent(QNetworkReply*))); // Use a timer to reduce the granularity of mouse events on Mac pMouseWheelTimer_ = new QTimer(this); pMouseWheelTimer_->setInterval(20); connect(pMouseWheelTimer_, SIGNAL(timeout()), this, SLOT(mouseWheelTimerFired())); }
WebPage::WebPage(QupZilla* mainClass) : QWebPage() , p_QupZilla(mainClass) , m_view(0) , m_speedDial(mApp->plugins()->speedDial()) , m_fileWatcher(0) , m_runningLoop(0) , m_blockAlerts(false) , m_secureStatus(false) , m_isClosing(false) { m_networkProxy = new NetworkManagerProxy(this); m_networkProxy->setPrimaryNetworkAccessManager(mApp->networkManager()); m_networkProxy->setPage(this); setNetworkAccessManager(m_networkProxy); setForwardUnsupportedContent(true); setPluginFactory(new WebPluginFactory(this)); history()->setMaximumItemCount(20); connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(handleUnsupportedContent(QNetworkReply*))); connect(this, SIGNAL(loadProgress(int)), this, SLOT(progress(int))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(finished())); connect(this, SIGNAL(printRequested(QWebFrame*)), this, SLOT(printFrame(QWebFrame*))); connect(this, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJavaScriptObject())); }
WebPage::WebPage(QObject* parent) : QWebPage(parent) , m_view(0) , m_fileWatcher(0) , m_runningLoop(0) , m_loadProgress(-1) , m_blockAlerts(false) , m_secureStatus(false) , m_adjustingScheduled(false) { m_javaScriptEnabled = QWebSettings::globalSettings()->testAttribute(QWebSettings::JavascriptEnabled); m_networkProxy = new NetworkManagerProxy(this); m_networkProxy->setPrimaryNetworkAccessManager(mApp->networkManager()); m_networkProxy->setPage(this); setNetworkAccessManager(m_networkProxy); setForwardUnsupportedContent(true); setPluginFactory(new WebPluginFactory(this)); history()->setMaximumItemCount(20); connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(handleUnsupportedContent(QNetworkReply*))); connect(this, SIGNAL(loadProgress(int)), this, SLOT(progress(int))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(finished())); connect(this, SIGNAL(printRequested(QWebFrame*)), this, SLOT(printFrame(QWebFrame*))); connect(this, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); connect(this, SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); frameCreated(mainFrame()); connect(this, SIGNAL(frameCreated(QWebFrame*)), this, SLOT(frameCreated(QWebFrame*))); connect(this, SIGNAL(databaseQuotaExceeded(QWebFrame*,QString)), this, SLOT(dbQuotaExceeded(QWebFrame*))); connect(mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJavaScriptObject())); #if QTWEBKIT_FROM_2_2 connect(this, SIGNAL(featurePermissionRequested(QWebFrame*,QWebPage::Feature)), this, SLOT(featurePermissionRequested(QWebFrame*,QWebPage::Feature))); #endif #if QTWEBKIT_FROM_2_3 connect(this, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin*,quint64,quint64)), this, SLOT(appCacheQuotaExceeded(QWebSecurityOrigin*,quint64))); #elif QTWEBKIT_FROM_2_2 connect(this, SIGNAL(applicationCacheQuotaExceeded(QWebSecurityOrigin*,quint64)), this, SLOT(appCacheQuotaExceeded(QWebSecurityOrigin*,quint64))); #endif s_livingPages.append(this); }
UtmpWebView::UtmpWebView():QWebView() { QWebSettings* default_settings = QWebSettings::globalSettings(); default_settings->setAttribute(QWebSettings::JavascriptEnabled,true); default_settings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled,true); default_settings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled,true); default_settings->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls,true); default_settings->setAttribute(QWebSettings::LocalStorageEnabled,true); default_settings->setAttribute(QWebSettings::JavascriptCanAccessClipboard,true); default_settings->setAttribute(QWebSettings::DeveloperExtrasEnabled,true); default_settings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); default_settings->setAttribute(QWebSettings::PluginsEnabled,true); default_settings->setAttribute(QWebSettings::JavascriptCanOpenWindows,true); //setContextMenuPolicy(Qt::NoContextMenu); //如何防止框架页面不被业务页面刷掉: //一般业务页面都是套在iframe中的,主要考虑防止target=_top的链接和window.top=''的js事件 //1:如下,可以截获所有链接的点击事件,但信号当中并不能确定这个链接是不是target = _top的 //this->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); //connect(this,SIGNAL(linkClicked(QUrl)),SLOT(openUrl(QUrl))); //2:可以重写QWebPage类的acceptNavigationRequest方法,但只能截获前进、后退、表单提交、刷新等操作,也不行 //3:可以考虑在框架页面中写JS,修改业务页面中的代码(下策) connect(this->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(populateJavaScriptWindowObject())); connect(this->page(), SIGNAL(printRequested(QWebFrame*)),this,SLOT(customPrintRequested(QWebFrame*))); this->page()->setForwardUnsupportedContent(true); //这个槽没什么用 connect(this->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(download(QNetworkRequest))); connect(this->page(),SIGNAL(unsupportedContent(QNetworkReply*)),this,SLOT(unsupportedContent(QNetworkReply*))); }
MiniWeb::MiniWeb(QWidget *parent) : KWebView(parent) { load(QUrl("about:blank")); connect(page(), SIGNAL(linkHovered(QString, QString, QString)), this, SIGNAL(statusBarMessage(QString))); updateConfiguration(); m_vi_mode = true; m_loading = false; connect(this, SIGNAL(loadStarted()), this, SLOT(setLoading())); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setNotLoading(bool))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setStatusLoaded(bool))); connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(setPageChanged())); connect(this, SIGNAL(linkMiddleOrCtrlClicked(KUrl)), this, SLOT(openInNewWindow(KUrl))); connect(page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(download(QNetworkRequest))); }
WebView::WebView(QWidget* parent) : QWebView(parent) , m_progress(0) , m_page(new WebPage(this)) { setPage(m_page); connect(page(), SIGNAL(statusBarMessage(QString)), SLOT(setStatusBarText(QString))); connect(this, SIGNAL(loadProgress(int)), this, SLOT(setProgress(int))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); connect(page(), SIGNAL(loadingUrl(QUrl)), this, SIGNAL(urlChanged(QUrl))); connect(page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); page()->setForwardUnsupportedContent(true); }
void WebRenderMainWindow::newTab() { // You must make the webview based connections here, because this is the birthplace of new BrowserView BrowserView *newView = new BrowserView(0,isIncognitoMode()); connect(newView,SIGNAL(titleChanged(BrowserView*,QString)),this,SLOT(titleChangeHandler(BrowserView*,QString))); newView->getWebView()->page()->setForwardUnsupportedContent(true); connect(newView->getWebView(),SIGNAL(openInNewTab(QUrl)),this,SLOT(newTab(QUrl))); connect(newView->getWebView(),SIGNAL(openInNewWindow(QUrl)),this,SLOT(newWindow(QUrl))); connect(newView->getWebView()->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(handleDownloadRequest(QNetworkRequest))); connect(newView->getWebView()->page(),SIGNAL(unsupportedContent(QNetworkReply*)),this,SLOT(handleDownloadRequest(QNetworkReply*))); ui->tabWidget->setCurrentIndex(ui->tabWidget->addTab(newView,"New Tab")); }
WebView::WebView(QUrl baseUrl, QWidget *parent) : QWebView(parent), baseUrl_(baseUrl) { #ifdef Q_WS_X11 if (!core::system::getenv("KDE_FULL_SESSION").empty()) setStyle(new QPlastiqueStyle()); #endif pWebPage_ = new WebPage(baseUrl, this); setPage(pWebPage_); page()->setForwardUnsupportedContent(true); if (desktop::options().webkitDevTools()) page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); connect(page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); connect(page(), SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(unsupportedContent(QNetworkReply*))); }
void BrowserDialog::initTab(BrowserView *newView) { newView->page()->setNetworkAccessManager(m_AccessManager); newView->page()->setForwardUnsupportedContent(true); connect(newView, SIGNAL(loadProgress(int)), this, SLOT(progress(int))); connect(newView, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged(QString))); connect(newView, SIGNAL(initTab(BrowserView*)), this, SLOT(initTab(BrowserView*))); connect(newView, SIGNAL(startFind()), this, SLOT(startSearch())); connect(newView, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl))); connect(newView, SIGNAL(openUrlInNewTab(QUrl)), this, SLOT(openInNewTab(QUrl))); connect(newView->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); connect(newView->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(unsupportedContent(QNetworkReply*))); ui->backBtn->setEnabled(false); ui->fwdBtn->setEnabled(false); m_Tabs->addTab(newView, tr("new")); newView->settings()->setAttribute(QWebSettings::PluginsEnabled, true); newView->settings()->setAttribute(QWebSettings::AutoLoadImages, true); }
void WebRenderMainWindow::newTab(QUrl url) { BrowserView *newView = new BrowserView(0,isIncognitoMode()); newView->getWebView()->page()->setForwardUnsupportedContent(true); connect(newView,SIGNAL(titleChanged(BrowserView*,QString)),this,SLOT(titleChangeHandler(BrowserView*,QString))); connect(newView->getWebView(),SIGNAL(openInNewTab(QUrl)),this,SLOT(newTab(QUrl))); connect(newView->getWebView(),SIGNAL(openInNewWindow(QUrl)),this,SLOT(newWindow(QUrl))); connect(newView->getWebView()->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(handleDownloadRequest(QNetworkRequest))); connect(newView->getWebView()->page(),SIGNAL(unsupportedContent(QNetworkReply*)),this,SLOT(handleDownloadRequest(QNetworkReply*))); ui->tabWidget->setCurrentIndex(ui->tabWidget->addTab(newView,"New Tab")); newView->getWebView()->load(url); }
void Tab::assignWebView(QWebView *view) { WebView = view; connect(WebView,SIGNAL(titleChanged(QString)),this,SLOT(setText(QString))); connect(WebView,SIGNAL(iconChanged()),this,SLOT(setTabIcon())); connect(WebView,SIGNAL(loadProgress(int)),this,SLOT(loadProgress(int))); connect(WebView,SIGNAL(loadStarted()),this,SLOT(loadStarted())); connect(WebView,SIGNAL(loadFinished(bool)),this,SLOT(loadFinished(bool))); connect(WebView->page(),SIGNAL(downloadRequested(QNetworkRequest)),this,SLOT(startDownload(QNetworkRequest))); connect(WebView->page(),SIGNAL(unsupportedContent(QNetworkReply*)),this,SLOT(startDownload(QNetworkReply*))); connect(stopAction,SIGNAL(triggered()),WebView,SLOT(stop())); connect(WebView->page()->networkAccessManager(),SIGNAL(networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility)),this,SLOT(showAccessError())); connect(WebView->page()->networkAccessManager(),SIGNAL(sslErrors(QNetworkReply*,const QList<QSslError> &)),this,SLOT(showSSLerror())); }
void tab::createConnects() { connect(urlAddress, SIGNAL(returnPressed()), this, SLOT(newUrl())); connect(addressCompleter, SIGNAL(itemChoosed(QString)), this, SLOT(newUrl(QString))); connect(webView, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl))); connect(webView, SIGNAL(titleChanged(QString)), this, SLOT(chTitle(QString))); connect(webView, SIGNAL(iconChanged()), this, SLOT(chIcon())); connect(webView, SIGNAL(statusBarMessage(QString)), this, SLOT(statusBarMessage(QString))); connect(webView, SIGNAL(selectionChanged()), this, SLOT(selectionChange())); connect(webView, SIGNAL(loadStarted()), this, SLOT(loadStart())); connect(webView, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int))); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinish(bool))); connect(webView, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClick(QUrl))); connect(webView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequest(QPoint))); connect(webView->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(downloadRequest(QNetworkReply*))); connect(webView->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequset(QNetworkRequest))); connect(webView->page(), SIGNAL(printRequested(QWebFrame*)), this, SLOT(printPage(QWebFrame*))); }
void PageRunner::finished(bool ok) { // bind nativeio if (!ok) { qApp->exit(1); } if (!scriptMode) { mainFrame()->evaluateJavaScript(getRuntimeBindings()); } // connect signals connect(this, SIGNAL(contentsChanged()), this, SLOT(noteChange())); connect(this, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(noteChange())); connect(this, SIGNAL(repaintRequested(QRect)), this, SLOT(noteChange())); connect(mainFrame(), SIGNAL(pageChanged()), this, SLOT(noteChange())); connect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(noteChange())); QTimer::singleShot(150, this, SLOT(reallyFinished())); changed = false; time.start(); }
LxDialogBase::LxDialogBase(QObject* object, QWebView* pWebView, QString strApiName, bool bshowloading, int gifW, int gifH) :LxOperate(object, pWebView, strApiName) { m_layout = NULL; m_movie = NULL; m_label = NULL; m_nWidth = 0; m_nHeight = 0; m_url = m_ptrWebView->url(); m_mainFrame = ((QWebView *)m_ptrWebView)->page()->mainFrame(); QObject::connect(m_ptrWebView->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); QObject::connect(m_ptrWebView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); m_showloading = bshowloading; if (m_showloading) { m_label = new QLabel(m_ptrWebView); m_layout = new QBoxLayout(QBoxLayout::LeftToRight, m_ptrWebView); m_lablW = gifW; m_lablH = gifH; qDebug() << QCoreApplication::applicationDirPath() + "/Resources/loading.gif"; m_movie = new QMovie(QCoreApplication::applicationDirPath() + "/Resources/loading.gif"); m_label->setStyleSheet("background-color: transparent;"); m_label->setScaledContents(true); m_label->setContentsMargins(0, 0, 0, 0); m_label->setAlignment(Qt::AlignCenter); m_label->resize(QSize(m_lablW, m_lablH)); m_label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); m_layout->addWidget(m_label, 0, Qt::AlignHCenter); // QSize size = m_ptrWebView->size(); // int nposx = (m_ptrWebView->width() - gifW) / 2; // int nposy = (m_ptrWebView->height() - gifH) / 2; // QPoint npoint = m_label->mapToParent(QPoint(nposx, nposy)); // m_label->setGeometry(npoint.x(), npoint.y(), gifW, gifH); m_label->setMovie(m_movie); m_movie->start(); } }
// --- NEW TAB --- // Open a new browser tab at the end of the tab bar. void MainWindow::newTab() { qDebug("Loading new tab..."); //QMessageBox msgBox; wv = new WFWebView(); //connect(wv, SIGNAL(loadFinished(bool)), this, SLOT(diagnoseLoad(bool))); connect(wv->page()->mainFrame(), SIGNAL(loadFinished(bool)), this, SLOT(diagnoseLoad(bool))); connect(wv, SIGNAL(titleChanged(QString)), this, SLOT(tabTitleChanged(QString))); if (wv == 0) { qDebug("WV is null"); return; } wv->page()->setNetworkAccessManager(nam); /*QWebSettings* ws = wv->settings(); ws->setAttribute(QWebSettings::PluginsEnabled, true); ws->setAttribute(QWebSettings::JavascriptCanOpenWindows, true); ws->setIconDatabasePath(icondb);*/ wv->page()->setForwardUnsupportedContent(true); // enable downloads connect(wv->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(downloadContent(QNetworkReply*))); // set up slot connect(wv->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadContent(QNetworkRequest))); // context menu call connect(wv->page(), SIGNAL(linkHovered(QString,QString,QString)), this, SLOT(linkHovered(QString,QString,QString))); qDebug("Settings changed."); int index = tabWidget->count(); ++index; index = tabWidget->insertTab(index, wv, tr("New Tab")); qDebug("Inserted tab."); addressBar->setText(""); //addressBar->setFocus(Qt::OtherFocusReason); gotoAddressBar(); tabWidget->setCurrentIndex(index); setWindowTitle("WildFox"); }
MainWindow::MainWindow(QString file_adress, QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { process = new QProcess(this); pfad = QCoreApplication::applicationDirPath(); QString buffer = QCoreApplication::applicationDirPath(); buffer.append("\\update.exe"); if(QFile::exists(buffer) == true) { QDesktopServices::openUrl(QUrl::fromLocalFile(buffer)); process->terminate(); } QSplashScreen *splash = new QSplashScreen(QPixmap(":/tbicons/img/logo.png"), Qt::WindowStaysOnTopHint); splash->show(); splash->showMessage("Laden...", Qt::AlignBottom | Qt::AlignCenter); ui->setupUi(this); this->hide(); set = new settings(this); icon = new favicon(this); search_result = new gsuggests(ui->lineEdit); versionspruefung = new update_vers(this); versionspruefung->run_request_for_for_update(); cookie = new cookiejar(this, set->en_cookies); bok = new bookmarks(this, ui->tree_bookmarks, ui->but_hinzu, ui->but_edit, ui->but_addFolder); download = new DownloadManager(this, qnam); m_faviconTimer = new QTimer(this); m_editorTimer = new QTimer(this); qnam = new QNetworkAccessManager(this); page = new QWebPage(this); ui->webView->setPage(page); ui->webView->page()->setNetworkAccessManager(qnam); QWebSettings::setIconDatabasePath(pfad); QWebSettings::setOfflineStoragePath((pfad + tr("\\offline_cache"))); QString cache_path = pfad; cache_path.append("\\cache"); cache = new QNetworkDiskCache(qnam); cache->setCacheDirectory(cache_path); qnam->setCache(cache); qnam->setCookieJar(cookie); // Bei klick auf Hme Button oder F6 funktion home aufrufen connect(ui->home_button, SIGNAL(clicked()), this, SLOT(home())); //Bei einem ändern der URl die neu_address auf rufen connect(ui->webView, SIGNAL(urlChanged(QUrl)), this, SLOT(neu_adresse(QUrl))); connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(neu_adresse_ein())); connect(ui->webView, SIGNAL(loadStarted()), this, SLOT(load_in_progress())); connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(load_finished(bool))); connect(ui->reload_button, SIGNAL(clicked()), this, SLOT(reload_button())); connect(ui->webView, SIGNAL(iconChanged()), this, SLOT(icon_changed())); connect(ui->webView, SIGNAL(titleChanged(QString)), this, SLOT(titelChanged(QString))); connect(ui->but_book, SIGNAL(clicked()), this, SLOT(showBar())); connect(ui->webView, SIGNAL(loadProgress(int)), ui->barLoadProgress, SLOT(setValue(int))); connect(ui->sliderrSiteZoom, SIGNAL(valueChanged(int)), this, SLOT(sliderSliding(int))); connect(ui->butSetZoomToNorm, SIGNAL(clicked()), this, SLOT(sliderSliding())); //für bookmarks connect(ui->tree_bookmarks, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(openBookmark(QTreeWidgetItem*, int))); //connections für favicons connect(icon, SIGNAL(neuer_icon()), this, SLOT(neuer_icon())); connect(icon, SIGNAL(standart_icon()), this, SLOT(set_standart_icon())); connect(m_faviconTimer, SIGNAL(timeout()), this, SLOT(lookForNewFavicon())); //connections für settings connect(ui->but_settings, SIGNAL(clicked()), set, SLOT(show())); connect(set, SIGNAL(requestForValues()), this, SLOT(returnRequestedValues())); connect(set, SIGNAL(settingsChagned()), this, SLOT(settingsChanged())); connect(set, SIGNAL(requestForCurrentPage()), this, SLOT(requestForCurrentPage())); connect(set->ui->but_cl_cache, SIGNAL(clicked()), this, SLOT(requestForCacheClearing())); //für qnam connect(qnam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authentification_requied(QNetworkReply*,QAuthenticator*))); //für downloads connect(page, SIGNAL(downloadRequested(QNetworkRequest)), download, SLOT(Download(QNetworkRequest))); connect(ui->butDownloadManager, SIGNAL(clicked()), download, SLOT(show())); ui->lineEdit->installEventFilter(this); if(file_adress != NULL) ui->webView->load(QUrl(file_adress)); else { if(!set->en_homePage) ui->webView->load(QUrl(set->lastUrl)); else ui->webView->load(QUrl(set->path_cur_home)); } this->resize(set->size); this->move(set->point); if(set->en_max) this->showMaximized(); if(!set->en_treeBar) ui->tabWidget->hide(); splash->finish(this); this->show(); m_faviconTimer->start(3000); shutted = true; }
void MainWindow::downloadPressed() { emit downloadRequested(m_tableView->currentIndex()); }
// Override the constructor so we always use a NWebPage // rather than a QWebPage NWebView::NWebView(NBrowserWindow *parent) : QWebView(parent) { this->parent = parent; editorPage = new NWebPage(this); setPage(editorPage); isDirty = false; this->setFont(global.getGuiFont(font())); contextMenu = new QMenu(this); openAction = new QAction(tr("Open"), this); contextMenu->addAction(openAction); contextMenu->addSeparator(); contextMenu->setFont(global.getGuiFont(font())); cutAction = new QAction(tr("Cut"), this); this->setupShortcut(cutAction, "Edit_Cut"); contextMenu->addAction(cutAction); connect(cutAction, SIGNAL(triggered()), parent, SLOT(cutButtonPressed())); copyAction = new QAction(tr("Copy"), this); this->setupShortcut(copyAction, "Edit_Copy"); contextMenu->addAction(copyAction); connect(copyAction, SIGNAL(triggered()), parent, SLOT(copyButtonPressed())); pasteAction = new QAction(tr("Paste"), this); setupShortcut(pasteAction, "Edit_Paste"); contextMenu->addAction(pasteAction); connect(pasteAction, SIGNAL(triggered()), parent, SLOT(pasteButtonPressed())); pasteWithoutFormatAction = new QAction(tr("Paste as Unformatted Text"), this); this->setupShortcut(pasteWithoutFormatAction, "Edit_Paste_Without_Formatting"); contextMenu->addAction(pasteWithoutFormatAction); connect(pasteWithoutFormatAction, SIGNAL(triggered()), parent, SLOT(pasteWithoutFormatButtonPressed())); removeFormattingAction = new QAction(tr("Remove Formatting"), this); this->setupShortcut(removeFormattingAction, "Edit_Remove_Formatting"); contextMenu->addAction(removeFormattingAction); connect(removeFormattingAction, SIGNAL(triggered()), parent, SLOT(removeFormatButtonPressed())); contextMenu->addSeparator(); QMenu *colorMenu = new QMenu(tr("Background Color"), this); colorMenu->setFont(global.getGuiFont(font())); QAction *action = setupColorMenuOption(tr("White")); colorMenu->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundWhite())); action = setupColorMenuOption(tr("Red")); colorMenu->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundRed())); action = setupColorMenuOption(tr("Blue")); colorMenu->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundBlue())); action = setupColorMenuOption(tr("Green")); colorMenu->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundGreen())); action = setupColorMenuOption(tr("Yellow")); colorMenu->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundYellow())); action = setupColorMenuOption(tr("Black")); colorMenu->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundBlack())); action = setupColorMenuOption(tr("Grey")); colorMenu->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundGrey())); action = setupColorMenuOption(tr("Purple")); colorMenu->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundPurple())); action = setupColorMenuOption(tr("Brown")); colorMenu->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundBrown())); action = setupColorMenuOption(tr("Orange")); colorMenu->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundOrange())); action = setupColorMenuOption(tr("Powder Blue")); colorMenu->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundPowderBlue())); contextMenu->addMenu(colorMenu); contextMenu->addSeparator(); todoAction = new QAction(tr("To-do"), this); contextMenu->addAction(todoAction); this->setupShortcut(todoAction, "Edit_Insert_Todo"); connect(todoAction, SIGNAL(triggered()), parent, SLOT(todoButtonPressed())); contextMenu->addSeparator(); insertHtmlEntitiesAction = new QAction(tr("HTML Entities"),this); contextMenu->addAction(insertHtmlEntitiesAction); this->setupShortcut(insertHtmlEntitiesAction, "Edit_Insert_Html_Entities"); connect(insertHtmlEntitiesAction, SIGNAL(triggered()), parent, SLOT(insertHtmlEntities())); contextMenu->addSeparator(); encryptAction = new QAction(tr("Encrypted Selected Text"), this); contextMenu->addAction(encryptAction); this->setupShortcut(encryptAction, "Edit_EncryptText"); connect(encryptAction, SIGNAL(triggered()), parent, SLOT(encryptButtonPressed())); insertLinkAction = new QAction(tr("Insert Hyperlink"), this); contextMenu->addAction(insertLinkAction); this->setupShortcut(insertLinkAction, "Edit_InsertHyperlink"); connect(insertLinkAction, SIGNAL(triggered()),parent, SLOT(insertLinkButtonPressed())); insertQuickLinkAction = new QAction(tr("Quick Link"), this); contextMenu->addAction(insertQuickLinkAction); this->setupShortcut(insertQuickLinkAction, "Edit_InsertQuickLink"); connect(insertQuickLinkAction, SIGNAL(triggered()),parent, SLOT(insertQuickLinkButtonPressed())); removeLinkAction = new QAction(tr("Remove Hyperlink"), this); contextMenu->addAction(removeLinkAction); this->setupShortcut(removeLinkAction, "Edit_RemoveHyperlink"); connect(removeLinkAction, SIGNAL(triggered()),parent, SLOT(removeLinkButtonPressed())); attachFileAction = new QAction(tr("Attach File"), this); contextMenu->addAction(attachFileAction); this->setupShortcut(attachFileAction, "Edit_Attach_File"); connect(attachFileAction, SIGNAL(triggered()),parent, SLOT(attachFile())); contextMenu->addSeparator(); insertLatexAction = new QAction(tr("Insert LaTeX Formula"), this); contextMenu->addAction(insertLatexAction); this->setupShortcut(insertLatexAction, "Edit_Insert_Latex"); connect(insertLatexAction, SIGNAL(triggered()),parent, SLOT(insertLatexButtonPressed())); contextMenu->addSeparator(); tableMenu = new QMenu(tr("Table"), this); tableMenu->setFont(global.getGuiFont(font())); contextMenu->addMenu(tableMenu); insertTableAction = new QAction(tr("Insert Table"), this); this->setupShortcut(insertTableAction, "Edit_Insert_Table"); tableMenu->addAction(insertTableAction); connect(insertTableAction, SIGNAL(triggered()), parent, SLOT(insertTableButtonPressed())); tableMenu->addSeparator(); insertTableRowAction = new QAction(tr("Insert Row"), this); this->setupShortcut(insertTableRowAction, "Edit_Insert_Table_Row"); tableMenu->addAction(insertTableRowAction); connect(insertTableRowAction, SIGNAL(triggered()), parent, SLOT(insertTableRowButtonPressed())); insertTableColumnAction = new QAction(tr("Insert Column"), this); this->setupShortcut(insertTableColumnAction, "Edit_Insert_Table_Column"); tableMenu->addAction(insertTableColumnAction); connect(insertTableColumnAction, SIGNAL(triggered()), parent, SLOT(insertTableColumnButtonPressed())); tableMenu->addSeparator(); deleteTableRowAction = new QAction(tr("Delete Row"), this); tableMenu->addAction(deleteTableRowAction); this->setupShortcut(deleteTableRowAction, "Edit_Delete_Table_Row"); connect(deleteTableRowAction, SIGNAL(triggered()), parent, SLOT(deleteTableRowButtonPressed())); deleteTableColumnAction = new QAction(tr("Delete Column"), this); tableMenu->addAction(deleteTableColumnAction); this->setupShortcut(deleteTableColumnAction, "Edit_Delete_Table_Column"); connect(deleteTableColumnAction, SIGNAL(triggered()), parent, SLOT(deleteTableColumnButtonPressed())); contextMenu->addSeparator(); imageMenu = new QMenu(tr("Image"), this); imageMenu->setFont(global.getGuiFont(font())); contextMenu->addMenu(imageMenu); downloadImageAction()->setText(tr("Save Image")); imageMenu->addAction(downloadImageAction()); // Don't connect this signal. The download attachmen signal will handle it. Otherwise // the signal fires twice. //connect(editorPage, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); imageMenu->addSeparator(); rotateImageLeftAction = new QAction(tr("Rotate Left"), this); imageMenu->addAction(rotateImageLeftAction); this->setupShortcut(rotateImageLeftAction, "Edit_Image_Rotate_Left"); connect(rotateImageLeftAction, SIGNAL(triggered()), parent, SLOT(rotateImageLeftButtonPressed())); rotateImageRightAction = new QAction(tr("Rotate Right"), this); this->setupShortcut(rotateImageRightAction, "Edit_Image_Rotate_Right"); imageMenu->addAction(rotateImageRightAction); connect(rotateImageRightAction, SIGNAL(triggered()), parent, SLOT(rotateImageRightButtonPressed())); contextMenu->addSeparator(); downloadAttachmentAction()->setText(tr("Save Attachment")); contextMenu->addAction(downloadAttachmentAction()); connect(editorPage, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); connect(editorPage, SIGNAL(contentsChanged()), this, SLOT(editAlert())); editorPage->setContentEditable(true); // Set some of the menus as disabled until a user selects an image or attachment downloadAttachmentAction()->setEnabled(false); rotateImageRightAction->setEnabled(false); rotateImageLeftAction->setEnabled(false); openAction->setEnabled(false); downloadImageAction()->setEnabled(false); connect(this->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(exposeToJavascript())); //this->setStyleSheet("QWebView,html,body { background-color : red; foreground-color : white; }"); QString qss = global.fileManager.getQssDirPathUser(""); if (qss == "") qss = global.fileManager.getQssDirPath(""); this->settings()->setUserStyleSheetUrl(QUrl("file://"+qss+"editor.css")); }
void RISE::createActions() { connect(page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); connect(pWebPage, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(unsupportedContent(QNetworkReply*))); }
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(); }