Beispiel #1
0
void TabbedWebView::setWebPage(WebPage* page)
{
    page->setWebView(this);
    page->setParent(this);
    setPage(page);

    connect(page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(linkHovered(QString, QString, QString)));
}
Beispiel #2
0
/** @short Connect various signals which require a certain reaction from the rest of the GUI */
void SimplePartWidget::connectGuiInteractionEvents(QObject *guiInteractionTarget)
{
    connect(this, SIGNAL(customContextMenuRequested(QPoint)), guiInteractionTarget, SLOT(partContextMenuRequested(QPoint)));

    // The targets expect the sender() of the signal to be a SimplePartWidget, not a QWebPage,
    // which means we have to do this indirection
    connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this, SIGNAL(linkHovered(QString,QString,QString)));
    connect(this, SIGNAL(linkHovered(QString,QString,QString)),
            guiInteractionTarget, SLOT(partLinkHovered(QString,QString,QString)));

    connect(this, SIGNAL(searchDialogRequested()), guiInteractionTarget, SLOT(triggerSearchDialog()));
}
Beispiel #3
0
zoomWindow::zoomWindow(Image *image, Site *site, QMap<QString,Site*> *sites, QWidget *)
    : QDialog(0, Qt::Window), ui(new Ui::zoomWindow), m_site(site), timeout(300), m_loaded(0), oldsize(0), image(NULL), movie(NULL), m_program(qApp->arguments().at(0)), m_reply(NULL), m_finished(false), m_thread(false), m_data(QByteArray()), m_size(0), m_sites(sites), m_source(), m_th(NULL), m_fullScreen(NULL)
{
	ui->setupUi(this);
	setAttribute(Qt::WA_DeleteOnClose);

	QList<Favorite> favorites = loadFavorites();
	for (Favorite fav : favorites)
		m_favorites.append(fav.getName());
	m_viewItLater = loadViewItLater();
    m_ignore = loadIgnored();
	m_image = new Image(site, image->details(), image->page());
	connect(m_image, &Image::urlChanged, this, &zoomWindow::urlChanged);

	m_mustSave = 0;

	QSettings settings(savePath("settings.ini"), QSettings::IniFormat);
	restoreGeometry(settings.value("Zoom/geometry").toByteArray());
	ui->buttonPlus->setChecked(settings.value("Zoom/plus", false).toBool());

	QShortcut *escape = new QShortcut(QKeySequence(Qt::Key_Escape), this);
		connect(escape, SIGNAL(activated()), this, SLOT(close()));
	QShortcut *save = new QShortcut(QKeySequence::Save, this);
		connect(save, SIGNAL(activated()), this, SLOT(saveImage()));
	QShortcut *saveAs = new QShortcut(QKeySequence("Ctrl+Shift+S"), this);
		connect(saveAs, SIGNAL(activated()), this, SLOT(saveImageAs()));

	m_labelTagsLeft = new QAffiche(QVariant(), 0, QColor(), this);
		m_labelTagsLeft->setContextMenuPolicy(Qt::CustomContextMenu);
		m_labelTagsLeft->setTextInteractionFlags(Qt::TextBrowserInteraction);
		connect(m_labelTagsLeft, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
		connect(m_labelTagsLeft, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
		connect(m_labelTagsLeft, SIGNAL(linkHovered(QString)), this, SLOT(linkHovered(QString)));
		connect(m_labelTagsLeft, SIGNAL(middleClicked()), this, SLOT(openInNewTab()));
		ui->scrollAreaWidgetContents->layout()->addWidget(m_labelTagsLeft);

	m_labelTagsTop = new QAffiche(QVariant(), 0, QColor(), this);
		m_labelTagsTop->setWordWrap(true);
		m_labelTagsTop->setContextMenuPolicy(Qt::CustomContextMenu);
		m_labelTagsTop->setTextInteractionFlags(Qt::TextBrowserInteraction);
		connect(m_labelTagsTop, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
		connect(m_labelTagsTop, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));
		connect(m_labelTagsTop, SIGNAL(linkHovered(QString)), this, SLOT(linkHovered(QString)));
		connect(m_labelTagsTop, SIGNAL(middleClicked()), this, SLOT(openInNewTab()));
		ui->verticalLayout->insertWidget(0, m_labelTagsTop, 0);

	m_imageTime = NULL;
	go();
}
Beispiel #4
0
lmcMessageLog::lmcMessageLog(QWidget *parent)
    : QWebView(parent)
{

	connect(this, SIGNAL(linkClicked(QUrl)), this, SLOT(log_linkClicked(QUrl)));
	connect(this->page()->mainFrame(), SIGNAL(contentsSizeChanged(QSize)),
			this, SLOT(log_contentsSizeChanged(QSize)));
	connect(this->page(), SIGNAL(linkHovered(QString, QString, QString)),
			this, SLOT(log_linkHovered(QString, QString, QString)));

	setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
	setRenderHints(QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);

	createContextMenu();

	participantAvatars.clear();
	hasData = false;
	messageTime = false;
	messageDate = false;
	allowLinks = false;
	pathToLink = false;
	trimMessage = true;
	fontSizeVal = 0;
	sendFileMap.clear();
	receiveFileMap.clear();
	lastId = QString::null;
	messageLog.clear();
	linkHovered = false;
	outStyle = false;
	autoScroll = true;
}
Beispiel #5
0
LiteDoc::LiteDoc(LiteApi::IApplication *app, QObject *parent) :
    LiteApi::ILiteDoc(parent),
    m_liteApp(app)
{
    m_docBrowser = new DocumentBrowser(app,this);
    m_docBrowser->urlComboBox()->setEditable(false);
    m_docBrowser->setName(tr("LiteIDE Documentation"));
    QStringList paths;
    paths << m_liteApp->resourcePath()+"/welcome" << localePath(m_liteApp->resourcePath()+"/welcome");
    m_docBrowser->setSearchPaths(paths);

    m_browserAct = m_liteApp->editorManager()->registerBrowser(m_docBrowser);
    //m_liteApp->actionManager()->insertViewMenu(LiteApi::ViewMenuBrowserPos,m_browserAct);

    connect(m_docBrowser,SIGNAL(requestUrl(QUrl)),this,SLOT(openUrl(QUrl)));
    connect(m_docBrowser,SIGNAL(linkHovered(QUrl)),this,SLOT(highlighted(QUrl)));

    QString path = localeFile(m_liteApp->resourcePath()+"/welcome/liteide.html");
    QFile file(path);
    if (file.open(QIODevice::ReadOnly)) {
        m_templateData = QString::fromUtf8(file.readAll());
        file.close();
    }

    m_liteApp->extension()->addObject("LiteApi.ILiteDoc",this);    
}
Beispiel #6
0
HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent)
    : QWebView(parent)
    , helpEngine(engine)
    , parentWidget(parent)
    , loadFinished(false)
{
    setAcceptDrops(false);

    setPage(new HelpPage(parent, helpEngine, this));

    page()->setNetworkAccessManager(new HelpNetworkAccessManager(engine, this));

    QAction* action = pageAction(QWebPage::OpenLinkInNewWindow);
    action->setText(tr("Open Link in New Tab"));
    if (!parent)
        action->setVisible(false);

    pageAction(QWebPage::DownloadLinkToDisk)->setVisible(false);
    pageAction(QWebPage::DownloadImageToDisk)->setVisible(false);
    pageAction(QWebPage::OpenImageInNewWindow)->setVisible(false);

    connect(pageAction(QWebPage::Copy), SIGNAL(changed()), this,
        SLOT(actionChanged()));
    connect(pageAction(QWebPage::Back), SIGNAL(changed()), this,
        SLOT(actionChanged()));
    connect(pageAction(QWebPage::Forward), SIGNAL(changed()), this,
        SLOT(actionChanged()));
    connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this,
        SIGNAL(highlighted(QString)));
    connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
}
Beispiel #7
0
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)));
}
Beispiel #8
0
WebViewHtmlWidget::WebViewHtmlWidget(QObject *parent) :
    IHtmlWidget(parent)
{
    m_widget = new QWebView;
    m_widget->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    connect(m_widget,SIGNAL(linkClicked(QUrl)),this,SIGNAL(linkClicked(QUrl)));
    connect(m_widget->page(),SIGNAL(linkHovered(QString,QString,QString)),this,SLOT(webLinkHovered(QString,QString,QString)));
    connect(m_widget->page(),SIGNAL(loadFinished(bool)),this,SIGNAL(loadFinished(bool)));
}
Beispiel #9
0
PopupWindow::PopupWindow(PopupWebView* view, bool showStatusBar)
    : QWidget()
    , m_view(view)
    , m_page(view->webPage())
{
    m_layout = new QVBoxLayout(this);
    m_layout->setContentsMargins(0, 0, 0, 0);
    m_layout->setSpacing(0);

    m_locationBar = new PopupLocationBar(this);
    m_locationBar->setView(m_view);

    m_statusBar = new QStatusBar(this);
    m_statusBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
    m_statusBar->setVisible(showStatusBar);

    m_progressBar = new ProgressBar(m_statusBar);
    m_statusBar->addPermanentWidget(m_progressBar);
    m_progressBar->hide();

    m_statusBarMessage = new PopupStatusBarMessage(this);

    m_layout->addWidget(m_locationBar);
    m_layout->addWidget(m_view);
    m_layout->addWidget(m_statusBar);
    setLayout(m_layout);

    connect(m_view, SIGNAL(showNotification(QWidget*)), this, SLOT(showNotification(QWidget*)));
    connect(m_view, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged()));
    connect(m_view, SIGNAL(urlChanged(QUrl)), m_locationBar, SLOT(showUrl(QUrl)));
    connect(m_view, SIGNAL(iconChanged()), m_locationBar, SLOT(showIcon()));
    connect(m_view, SIGNAL(statusBarMessage(QString)), this, SLOT(showStatusBarMessage(QString)));
    connect(m_view, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
    connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int)));
    connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));

    connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(showStatusBarMessage(QString)));
    connect(m_page, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(setWindowGeometry(QRect)));
    connect(m_page, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(setStatusBarVisibility(bool)));
    connect(m_page, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(setMenuBarVisibility(bool)));
    connect(m_page, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(setToolBarVisibility(bool)));

    m_view->setFocus();
    titleChanged();

    QUrl urlToShow = m_view->url();
    if (urlToShow.isEmpty()) {
        urlToShow = m_view->page()->mainFrame()->requestedUrl();
    }

    m_locationBar->showUrl(urlToShow);

    // Ensuring correct sizes for widgets in layout are calculated even
    // before calling QWidget::show()
    m_layout->invalidate();
    m_layout->activate();
}
Beispiel #10
0
TextBrowserHtmlWidget::TextBrowserHtmlWidget(QObject *parent) :
    IHtmlWidget(parent)
{
    m_widget = new QTextBrowser;
    m_widget->setOpenLinks(false);
    m_widget->setOpenExternalLinks(false);
    connect(m_widget,SIGNAL(anchorClicked(QUrl)),this,SIGNAL(linkClicked(QUrl)));
    connect(m_widget,SIGNAL(highlighted(QUrl)),this,SIGNAL(linkHovered(QUrl)));
}
Beispiel #11
0
void TabbedWebView::setWebPage(WebPage* page)
{
    if (m_page == page) {
        return;
    }

    if (m_page) {
        delete m_page;
        m_page = 0;
    }

    m_page = page;
    m_page->setWebView(this);
    m_page->setParent(this);
    setPage(m_page);

    connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(linkHovered(QString, QString, QString)));
    connect(m_page, SIGNAL(windowCloseRequested()), this, SLOT(closeView()));
}
void MarkdownEditAreaWidget::initPreviewerMatter()
{
    connect( previewer, SIGNAL( linkClicked( QUrl ) ),
             this, SLOT( openUrl( QUrl ) ) );
    markdownWebkitHandler = new MarkdownWebkitHandler();
    addJavascriptObject();//warning:add before setHtml!!!!!!!!!!!!!!!!!!!!!!!!!!
    QObject::connect( previewer->page()->mainFrame(), SIGNAL( javaScriptWindowObjectCleared() ),
                      this, SLOT( addJavascriptObject() ) );
    QObject::connect( previewer->page(), SIGNAL( linkHovered( QString, QString, QString ) ),
                      this, SIGNAL( showStatusMessage( QString ) ) );
    initHtmlEngine();
}
WelcomeBrowser::WelcomeBrowser(LiteApi::IApplication *app, QObject *parent)
    : LiteApi::IBrowserEditor(parent),
      m_liteApp(app),
      m_extension(new Extension),
      m_widget(new QWidget)
{
    m_browser = new DocumentBrowser(m_liteApp,this);
    m_browser->toolBar()->hide();

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);

    mainLayout->addWidget(m_browser->widget());

    QPushButton *newFile = new QPushButton(tr("New"));
    QPushButton *openFile = new QPushButton(tr("Open"));
    QPushButton *openFolder = new QPushButton(tr("Open Folder"));
    QPushButton *options = new QPushButton(tr("Options"));

    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(newFile);
    layout->addWidget(openFile);
    layout->addWidget(openFolder);
    layout->addStretch(1);
    layout->addWidget(options);

    mainLayout->addLayout(layout);

    m_widget->setLayout(mainLayout);

    connect(newFile,SIGNAL(clicked()),m_liteApp->fileManager(),SLOT(newFile()));
    connect(openFile,SIGNAL(clicked()),m_liteApp->fileManager(),SLOT(openFiles()));
    connect(openFolder,SIGNAL(clicked()),this,SLOT(openFolder()));

    connect(options,SIGNAL(clicked()),m_liteApp->optionManager(),SLOT(exec()));
    connect(m_browser,SIGNAL(requestUrl(QUrl)),this,SLOT(openUrl(QUrl)));
    connect(m_liteApp->fileManager(),SIGNAL(recentFilesChanged(QString)),this,SLOT(loadData()));
    connect(m_browser,SIGNAL(linkHovered(QUrl)),this,SLOT(highlightedUrl(QUrl)));

    QStringList paths;
    paths << m_liteApp->resourcePath()+"/welcome" << LiteDoc::localePath(m_liteApp->resourcePath()+"/welcome");
    m_browser->setSearchPaths(paths);

    m_extension->addObject("LiteApi.QTextBrowser",m_browser->htmlWidget()->widget());

    QString path = LiteDoc::localeFile(m_liteApp->resourcePath()+"/welcome/welcome.html");
    QFile file(path);
    if (file.open(QIODevice::ReadOnly)) {
        m_templateData = QString::fromUtf8(file.readAll());
        file.close();
    }
    loadData();
}
Beispiel #14
0
WebKitBrowser::WebKitBrowser(LiteApi::IApplication *app, QWidget *parent) :
    QWidget(parent), m_liteApp(app)
{        
    QNetworkProxyFactory::setUseSystemConfiguration(true);

    m_view = new QWebView;
    m_view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);

    m_locationEdit = new QLineEdit(this);
    m_locationEdit->setSizePolicy(QSizePolicy::Expanding, m_locationEdit->sizePolicy().verticalPolicy());
    connect(m_locationEdit, SIGNAL(returnPressed()), this,SLOT(changeLocation()));
    connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
    connect(m_view, SIGNAL(linkClicked(QUrl)),this, SLOT(linkClicked(QUrl)));
    connect(m_view->page(), SIGNAL(linkHovered(QString,QString,QString)),this,SLOT(linkHovered(QString,QString,QString)));
    connect(m_view,SIGNAL(statusBarMessage(QString)),this,SLOT(statusBarMessage(QString)));
    connect(m_view,SIGNAL(loadStarted()),this,SLOT(loadStarted()));
    connect(m_view,SIGNAL(loadProgress(int)),this,SLOT(loadProgress(int)));

    QToolBar *toolBar = new QToolBar(tr("Navigation"));
    toolBar->setIconSize(QSize(16,16));
    toolBar->addAction(m_view->pageAction(QWebPage::Back));
    toolBar->addAction(m_view->pageAction(QWebPage::Forward));
    toolBar->addAction(m_view->pageAction(QWebPage::Reload));
    toolBar->addAction(m_view->pageAction(QWebPage::Stop));
    toolBar->addWidget(m_locationEdit);

    m_progressBar = new QProgressBar;
    m_progressBar->hide();
    m_progressBar->setRange(0,100);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->setMargin(0);
    layout->setSpacing(0);

    layout->addWidget(toolBar);
    layout->addWidget(m_view);
    layout->addWidget(m_progressBar);

    this->setLayout(layout);
}
Beispiel #15
0
void TabWidget::currentChanged(int index)
{
    WebView *webView = this->webView(index);
    if (!webView)
        return;

    Q_ASSERT(m_lineEdits->count() == count());

    WebView *oldWebView = this->webView(m_lineEdits->currentIndex());
    if (oldWebView) {
        disconnect(oldWebView, SIGNAL(statusBarMessage(QString)),
                   this, SIGNAL(showStatusBarMessage(QString)));
        disconnect(oldWebView->page(), SIGNAL(linkHovered(QString,QString,QString)),
                   this, SIGNAL(linkHovered(QString)));
        disconnect(oldWebView, SIGNAL(loadProgress(int)),
                   this, SIGNAL(loadProgress(int)));
    }

    connect(webView, SIGNAL(statusBarMessage(QString)),
            this, SIGNAL(showStatusBarMessage(QString)));
    connect(webView->page(), SIGNAL(linkHovered(QString,QString,QString)),
            this, SIGNAL(linkHovered(QString)));
    connect(webView, SIGNAL(loadProgress(int)),
            this, SIGNAL(loadProgress(int)));

    for (int i = 0; i < m_actions.count(); ++i) {
        WebActionMapper *mapper = m_actions[i];
        mapper->updateCurrent(webView->page());
    }
    emit setCurrentTitle(webView->title());
    m_lineEdits->setCurrentIndex(index);
    emit loadProgress(webView->progress());
    emit showStatusBarMessage(webView->lastStatusBarText());
    if (webView->url().isEmpty())
        m_lineEdits->currentWidget()->setFocus();
    else
        webView->setFocus();
}
Beispiel #16
0
// --- 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");
}
Beispiel #17
0
void KWebKitPart::connectWebPageSignals(WebPage* page)
{
    if (!page)
        return;

    connect(page, SIGNAL(loadStarted()),
            this, SLOT(slotLoadStarted()));
    connect(page, SIGNAL(loadAborted(QUrl)),
            this, SLOT(slotLoadAborted(QUrl)));
    connect(page, SIGNAL(linkHovered(QString,QString,QString)),
            this, SLOT(slotLinkHovered(QString,QString,QString)));
    connect(page, SIGNAL(saveFrameStateRequested(QWebFrame*,QWebHistoryItem*)),
            this, SLOT(slotSaveFrameState(QWebFrame*,QWebHistoryItem*)));
    connect(page, SIGNAL(restoreFrameStateRequested(QWebFrame*)),
            this, SLOT(slotRestoreFrameState(QWebFrame*)));
    connect(page, SIGNAL(statusBarMessage(QString)),
            this, SLOT(slotSetStatusBarText(QString)));
    connect(page, SIGNAL(windowCloseRequested()),
            this, SLOT(slotWindowCloseRequested()));
    connect(page, SIGNAL(printRequested(QWebFrame*)),
            m_browserExtension, SLOT(slotPrintRequested(QWebFrame*)));
    connect(page, SIGNAL(frameCreated(QWebFrame*)),
            this, SLOT(slotFrameCreated(QWebFrame*)));

    connect(m_webView, SIGNAL(linkShiftClicked(QUrl)),
            page, SLOT(downloadUrl(QUrl)));

    connect(page, SIGNAL(loadProgress(int)),
            m_browserExtension, SIGNAL(loadingProgress(int)));
    connect(page, SIGNAL(selectionChanged()),
            m_browserExtension, SLOT(updateEditActions()));
    connect(m_browserExtension, SIGNAL(saveUrl(QUrl)),
            page, SLOT(downloadUrl(QUrl)));

    connect(page->mainFrame(), SIGNAL(loadFinished(bool)),
            this, SLOT(slotMainFrameLoadFinished(bool)));


    KWebWallet *wallet = page->wallet();
    if (wallet) {
        connect(wallet, SIGNAL(saveFormDataRequested(QString,QUrl)),
                this, SLOT(slotSaveFormDataRequested(QString,QUrl)));
        connect(wallet, SIGNAL(fillFormRequestCompleted(bool)),
                this, SLOT(slotFillFormRequestCompleted(bool)));
        connect(wallet, SIGNAL(walletClosed()), this, SLOT(slotWalletClosed()));
    }
}
Beispiel #18
0
//! Constructor
//! @param pParent is the pointer to DocumentationWidget.
DocumentationViewer::DocumentationViewer(DocumentationWidget *pParent)
  : QWebView(pParent)
{
  setContextMenuPolicy(Qt::CustomContextMenu);
  connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showContextMenu(QPoint)));
  mpDocumentationWidget = pParent;
  zoomFact = 1.;
  setZoomFactor(zoomFact);
  // set DocumentationViewer settings
  settings()->setFontFamily(QWebSettings::StandardFont, "Verdana");
  settings()->setFontSize(QWebSettings::DefaultFontSize, 10);
  settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
  settings()->setDefaultTextEncoding(Helper::utf8.toStdString().data());
  // set DocumentationViewer web page policy
  page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
  connect(page(), SIGNAL(linkClicked(QUrl)), SLOT(processLinkClick(QUrl)));
  connect(page(), SIGNAL(linkHovered(QString,QString,QString)), SLOT(processLinkHover(QString,QString,QString)));
}
Beispiel #19
0
PopupWindow::PopupWindow(PopupWebView* view)
    : QWidget()
    , m_view(view)
    , m_page(view->webPage())
{
    m_layout = new QVBoxLayout(this);
    m_layout->setContentsMargins(0, 0, 0, 0);
    m_layout->setSpacing(0);

    m_locationBar = new PopupLocationBar(this);
    m_locationBar->setView(m_view);

    m_statusBar = new QStatusBar(this);
    m_statusBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);

    m_layout->addWidget(m_locationBar);
    m_layout->addWidget(m_view);
    m_layout->addWidget(m_statusBar);
    setLayout(m_layout);

    connect(m_view, SIGNAL(showNotification(QWidget*)), this, SLOT(showNotification(QWidget*)));
    connect(m_view, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged()));
    connect(m_view, SIGNAL(urlChanged(QUrl)), m_locationBar, SLOT(showUrl(QUrl)));
    connect(m_view, SIGNAL(iconChanged()), m_locationBar, SLOT(showIcon()));
    connect(m_view, SIGNAL(statusBarMessage(QString)), m_statusBar, SLOT(showMessage(QString)));

    connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), m_statusBar, SLOT(showMessage(QString)));
    connect(m_page, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(setWindowGeometry(QRect)));
    connect(m_page, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(setStatusBarVisibility(bool)));
    connect(m_page, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(setMenuBarVisibility(bool)));
    connect(m_page, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(setToolBarVisibility(bool)));
    connect(m_page, SIGNAL(windowCloseRequested()), this, SLOT(close()));

    m_view->setFocus();
    titleChanged();

    QUrl urlToShow = m_view->url();
    if (urlToShow.isEmpty()) {
        urlToShow = m_view->page()->mainFrame()->requestedUrl();
    }

    m_locationBar->showUrl(urlToShow);
}
Beispiel #20
0
EnvelopeView::EnvelopeView(QWidget *parent, MessageView *messageView): QLabel(parent)
{
    // we create a dummy header, pass it through the style and the use it's color roles so we
    // know what headers in general look like in the system
    QHeaderView helpingHeader(Qt::Horizontal);
    helpingHeader.ensurePolished();

    setBackgroundRole(helpingHeader.backgroundRole());
    setForegroundRole(helpingHeader.foregroundRole());
    setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
    setIndent(5);
    setWordWrap(true);
    connect(this, SIGNAL(linkHovered(QString)), this, SLOT(onLinkHovered(QString)));

    QFontMetrics fm(font());
    int iconSize = fm.boundingRect(QLatin1Char('M')).height();
    contactKnownUrl = Gui::Util::resizedImageAsDataUrl(QLatin1String(":/icons/contact-known.png"), iconSize);
    contactUnknownUrl = Gui::Util::resizedImageAsDataUrl(QLatin1String(":/icons/contact-unknown.png"), iconSize);

    connect(this, SIGNAL(linkActivated(QString)), messageView, SLOT(headerLinkActivated(QString)));
    connect(this, SIGNAL(addressDetailsRequested(QString,QStringList&)),
            messageView, SIGNAL(addressDetailsRequested(QString,QStringList&)));
}
Beispiel #21
0
void QLabelPrivate::ensureTextControl() const
{
    Q_Q(const QLabel);
    if (!isTextLabel)
        return;
    if (!control) {
        control = new QWidgetTextControl(const_cast<QLabel *>(q));
        control->document()->setUndoRedoEnabled(false);
        control->document()->setDefaultFont(q->font());
        control->setTextInteractionFlags(textInteractionFlags);
        control->setOpenExternalLinks(openExternalLinks);
        control->setPalette(q->palette());
        control->setFocus(q->hasFocus());
        QObject::connect(control, SIGNAL(updateRequest(QRectF)),
                         q, SLOT(update()));
        QObject::connect(control, SIGNAL(linkHovered(QString)),
                         q, SLOT(_q_linkHovered(QString)));
        QObject::connect(control, SIGNAL(linkActivated(QString)),
                         q, SIGNAL(linkActivated(QString)));
        textLayoutDirty = true;
        textDirty = true;
    }
}
Beispiel #22
0
HelpWebView::HelpWebView(IEditorSite::Pointer editorSite, QWidget *parent, qreal zoom)
  : QWebView(parent)
  //, parentWidget(parent)
  , m_LoadFinished(false)
  , m_HelpEngine(HelpPluginActivator::getInstance()->getQHelpEngine())
{
  setAcceptDrops(false);

  setPage(new HelpPage(editorSite, parent));

  page()->setNetworkAccessManager(new HelpNetworkAccessManager(this));

  QAction* action = pageAction(QWebPage::OpenLinkInNewWindow);
  action->setText(tr("Open Link in New Tab"));
  if (!parent)
    action->setVisible(false);

  pageAction(QWebPage::DownloadLinkToDisk)->setVisible(false);
  pageAction(QWebPage::DownloadImageToDisk)->setVisible(false);
  pageAction(QWebPage::OpenImageInNewWindow)->setVisible(false);

  connect(pageAction(QWebPage::Copy), SIGNAL(changed()), this,
          SLOT(actionChanged()));
  connect(pageAction(QWebPage::Back), SIGNAL(changed()), this,
          SLOT(actionChanged()));
  connect(pageAction(QWebPage::Forward), SIGNAL(changed()), this,
          SLOT(actionChanged()));
  connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this,
          SIGNAL(highlighted(QString)));
  connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl)));
  connect(this, SIGNAL(loadStarted()), this, SLOT(setLoadStarted()));
  connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool)));
  connect(page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested()));

  setFont(viewerFont());
  setTextSizeMultiplier(zoom == 0.0 ? 1.0 : zoom);
}
Beispiel #23
0
void AMPWebView::slotLinkHovered( const QString &link, const QString &title, const QString &content )
{
    qDebug( "slotLinkHovered() %s %s %s", qPrintable( link ), qPrintable( title ), qPrintable( content ) );
    emit linkHovered( link, title, content );
}
Beispiel #24
0
MainWindow::MainWindow(bool useSocket, QWidget *parent) :
    ParentWindow(parent),
    m_page(0),
    m_webView(new QGraphicsWebView),
#ifndef MEEGO_EDITION_HARMATTAN
    m_actionMinimizeToTray(new QAction(i18n("&Minimize to Tray"), this)),
#endif
    m_inspector(0),
    m_useSocket(useSocket)

{
#ifdef Q_OS_UNIX
    chdir(PREFIX);
#endif
    setWindowTitle(i18n("Hotot"));
    setWindowIcon(QIcon::fromTheme("hotot_qt", QIcon("share/hotot/image/ic64_hotot.png")));
    qApp->setWindowIcon(QIcon::fromTheme("hotot_qt", QIcon("share/hotot/image/ic64_hotot.png")));
    m_webView->setPreferredSize(QSize(640, 480));
#ifndef MEEGO_EDITION_HARMATTAN
    HototWebView* view = new HototWebView(m_webView, this);
    this->resize(QSize(640, 480));
    this->setCentralWidget(view);
    this->setMinimumSize(QSize(400, 400));
#else
    MApplicationPage* page = new MApplicationPage;
    page->setCentralWidget(m_webView);
    page->setComponentsDisplayMode(MApplicationPage::AllComponents,
                                           MApplicationPageModel::Hide);
    page->setAutoMarginsForComponentsEnabled(false);
    page->resize(page->exposedContentRect().size());
    page->appear(this, MSceneWindow::DestroyWhenDone);
    page->setPannable(false);
#endif

#ifndef MEEGO_EDITION_HARMATTAN
    QSettings settings("hotot-qt", "hotot");
    restoreGeometry(settings.value("geometry").toByteArray());
    restoreState(settings.value("windowState").toByteArray());
#endif

    m_menu = new QMenu(this);

#ifndef MEEGO_EDITION_HARMATTAN
    m_actionMinimizeToTray->setCheckable(true);
    m_actionMinimizeToTray->setChecked(settings.value("minimizeToTray", true).toBool());
    connect(m_actionMinimizeToTray, SIGNAL(toggled(bool)), this, SLOT(toggleMinimizeToTray(bool)));
    m_menu->addAction(m_actionMinimizeToTray);
#endif
    m_actionShow = new QAction(QIcon(), i18n("Show &MainWindow"), this);
    connect(m_actionShow, SIGNAL(triggered()), this, SLOT(show()));
    m_menu->addAction(m_actionShow);

    m_actionExit = new QAction(QIcon::fromTheme("application-exit"), i18n("&Exit"), this);
    m_actionExit->setShortcut(QKeySequence::Quit);
    connect(m_actionExit, SIGNAL(triggered()), this, SLOT(exit()));
    m_menu->addAction(m_actionExit);

    m_actionDev = new QAction(QIcon::fromTheme("configure"), i18n("&Developer Tool"), this);
    connect(m_actionDev, SIGNAL(triggered()), this, SLOT(showDeveloperTool()));

#ifdef HAVE_KDE
    m_tray = new KDETrayBackend(this);
#else
    m_tray = new QtTrayBackend(this);
#endif

    m_tray->setContextMenu(m_menu);
#ifndef MEEGO_EDITION_HARMATTAN
    addAction(m_actionExit);
#endif

    m_page = new HototWebPage(this);

    QWebSettings::setOfflineStoragePath(QDir::homePath().append("/.config/hotot-qt"));
    QWebSettings::setOfflineStorageDefaultQuota(15 * 1024 * 1024);

    m_webView->setPage(m_page);
    m_webView->settings()->globalSettings()->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, true);
    m_webView->settings()->globalSettings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true);
    m_webView->settings()->globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
    m_webView->settings()->globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);
    m_webView->settings()->globalSettings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
    m_webView->settings()->globalSettings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
    m_webView->settings()->globalSettings()->setAttribute(QWebSettings::JavascriptEnabled, true);

    m_inspector = new QWebInspector;
    m_inspector->setPage(m_page);

#ifdef MEEGO_EDITION_HARMATTAN
    connect(page, SIGNAL(exposedContentRectChanged()), this, SLOT(contentSizeChanged()));
    m_page->setPreferredContentsSize(page->exposedContentRect().size().toSize());
    m_webView->setResizesToContents(true);
#endif

#ifdef Q_OS_UNIX
    m_webView->load(QUrl("file://" PREFIX "/share/hotot/index.html"));
#else
    QFileInfo f("share/hotot/index.html");
    m_webView->load(QUrl::fromLocalFile(f.absoluteFilePath()));
#endif
    connect(m_webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
    connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(onLinkHovered(QString, QString, QString)));
}
Beispiel #25
0
DocumentBrowser::DocumentBrowser(LiteApi::IApplication *app, QObject *parent) :
    LiteApi::IDocumentBrowser(parent),
    m_liteApp(app),
    m_extension(new Extension)
{
    m_widget = new QWidget;

    m_htmlWidget = app->htmlWidgetManager()->createByName(this,"QTextBrowser");

    m_toolBar = new QToolBar;
    m_toolBar->setIconSize(LiteApi::getToolBarIconSize());

    m_backwardAct = new QAction(QIcon("icon:images/backward.png"),tr("Back"),this);
    m_forwardAct = new QAction(QIcon("icon:images/forward.png"),tr("Forward"),this);
    m_reloadUrlAct = new QAction(QIcon("icon:images/reload.png"),tr("Reload"),this);
    m_toolBar->addAction(m_backwardAct);
    m_toolBar->addAction(m_forwardAct);

    LiteApi::IActionContext *actionContext = m_liteApp->actionManager()->getActionContext(this,"Document");

    m_increaseFontSize = new QAction(tr("Increase Font Size"),this);
    actionContext->regAction(m_increaseFontSize,"IncreaseFontSize","Ctrl++;Ctrl+=");

    m_decreaseFontSize = new QAction(tr("Decrease Font Size"),this);
    actionContext->regAction(m_decreaseFontSize,"DecreaseFontSize","Ctrl+-");

    m_resetFontSize = new QAction(tr("Reset Font Size"),this);
    actionContext->regAction(m_resetFontSize,"ResizeFontSize","Ctrl+0");

    m_urlComboBox = new QComboBox;
    m_urlComboBox->setEditable(true);
    m_urlComboBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);

    m_toolBar->addSeparator();
    m_toolBar->addWidget(m_urlComboBox);
    m_toolBar->addAction(m_reloadUrlAct);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);

    mainLayout->addWidget(m_toolBar);
    mainLayout->addWidget(m_htmlWidget->widget());
    m_widget->setLayout(mainLayout);

    m_widget->addAction(m_increaseFontSize);
    m_widget->addAction(m_decreaseFontSize);
    m_widget->addAction(m_resetFontSize);

    connect(m_increaseFontSize,SIGNAL(triggered()),this,SLOT(increaseFontSize()));
    connect(m_decreaseFontSize,SIGNAL(triggered()),this,SLOT(decreaseFontSize()));
    connect(m_resetFontSize,SIGNAL(triggered()),this,SLOT(resetFontSize()));
    connect(m_htmlWidget,SIGNAL(linkHovered(QUrl)),this,SIGNAL(linkHovered(QUrl)));
    connect(m_htmlWidget,SIGNAL(linkClicked(QUrl)),this,SLOT(linkClicked(QUrl)));
    connect(m_htmlWidget,SIGNAL(loadFinished(bool)),this,SIGNAL(documentLoaded()));
    connect(m_backwardAct,SIGNAL(triggered()),this,SLOT(backward()));
    connect(m_forwardAct,SIGNAL(triggered()),this,SLOT(forward()));
    connect(m_reloadUrlAct,SIGNAL(triggered()),this,SLOT(reloadUrl()));
    connect(m_urlComboBox,SIGNAL(activated(QString)),this,SLOT(activatedUrl(QString)));
    connect(this,SIGNAL(backwardAvailable(bool)),m_backwardAct,SLOT(setEnabled(bool)));
    connect(this,SIGNAL(forwardAvailable(bool)),m_forwardAct,SLOT(setEnabled(bool)));

    m_extension->addObject("LiteApi.IDocumentBrowser",this);
    m_extension->addObject("LiteApi.IHtmlWidget",m_htmlWidget);
    m_extension->addObject("LiteApi.QTextBrowser",m_htmlWidget->widget());
    m_htmlWidget->installEventFilter(m_liteApp->editorManager());

    requestFontZoom(0);

    QPalette p = m_htmlWidget->widget()->palette();
    p.setBrush(QPalette::Highlight,Qt::yellow);
    p.setColor(QPalette::HighlightedText,Qt::black);
    m_htmlWidget->widget()->setPalette(p);

    emit backwardAvailable(false);
    emit forwardAvailable(false);
}
Beispiel #26
0
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();
}
Beispiel #27
0
void PHILabelItem::slotAnchorHover( const QUrl &url )
{
    emit linkHovered( url.toString() );
}
Beispiel #28
0
PopupWindow::PopupWindow(PopupWebView* view)
    : QWidget()
    , m_view(view)
    , m_page(qobject_cast<PopupWebPage*>(view->page()))
    , m_search(0)
{
    m_layout = new QVBoxLayout(this);
    m_layout->setContentsMargins(0, 0, 0, 0);
    m_layout->setSpacing(0);

    m_locationBar = new PopupLocationBar(this);
    m_locationBar->setView(m_view);

    m_statusBar = new QStatusBar(this);
    m_statusBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);

    m_progressBar = new ProgressBar(m_statusBar);
    m_statusBar->addPermanentWidget(m_progressBar);
    m_progressBar->hide();

    m_view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_statusBarMessage = new PopupStatusBarMessage(this);

    m_menuBar = new QMenuBar(this);

    QMenu* menuFile = new QMenu(tr("File"));
    menuFile->addAction(QIcon::fromTheme("document-save"), tr("&Save Page As..."), m_view, SLOT(savePageAs()))->setShortcut(QKeySequence("Ctrl+S"));
    menuFile->addAction(tr("Save Page Screen"), this, SLOT(savePageScreen()));
    menuFile->addAction(QIcon::fromTheme("mail-message-new"), tr("Send Link..."), m_view, SLOT(sendPageByMail()));
    menuFile->addAction(QIcon::fromTheme("document-print"), tr("&Print..."), m_view, SLOT(printPage()))->setShortcut(QKeySequence("Ctrl+P"));
    menuFile->addSeparator();
    menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close"), this, SLOT(close()))->setShortcut(QKeySequence("Ctrl+W"));
    m_menuBar->addMenu(menuFile);

    m_menuEdit = new QMenu(tr("Edit"));
    m_menuEdit->addAction(QIcon::fromTheme("edit-undo"), tr("&Undo"), this, SLOT(editUndo()))->setShortcut(QKeySequence("Ctrl+Z"));
    m_menuEdit->addAction(QIcon::fromTheme("edit-redo"), tr("&Redo"), this, SLOT(editRedo()))->setShortcut(QKeySequence("Ctrl+Shift+Z"));
    m_menuEdit->addSeparator();
    m_menuEdit->addAction(QIcon::fromTheme("edit-cut"), tr("&Cut"), this, SLOT(editCut()))->setShortcut(QKeySequence("Ctrl+X"));
    m_menuEdit->addAction(QIcon::fromTheme("edit-copy"), tr("C&opy"), this, SLOT(editCopy()))->setShortcut(QKeySequence("Ctrl+C"));
    m_menuEdit->addAction(QIcon::fromTheme("edit-paste"), tr("&Paste"), this, SLOT(editPaste()))->setShortcut(QKeySequence("Ctrl+V"));
    m_menuEdit->addSeparator();
    m_menuEdit->addAction(QIcon::fromTheme("edit-select-all"), tr("Select All"), m_view, SLOT(selectAll()))->setShortcut(QKeySequence("Ctrl+A"));
    m_menuEdit->addAction(QIcon::fromTheme("edit-find"), tr("Find"), this, SLOT(searchOnPage()))->setShortcut(QKeySequence("Ctrl+F"));
    connect(m_menuEdit, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEditMenu()));
    m_menuBar->addMenu(m_menuEdit);

    m_menuView = new QMenu(tr("View"));
    m_actionStop = m_menuView->addAction(qIconProvider->standardIcon(QStyle::SP_BrowserStop), tr("&Stop"), m_view, SLOT(stop()));
    m_actionStop->setShortcut(QKeySequence("Esc"));
    m_actionReload = m_menuView->addAction(qIconProvider->standardIcon(QStyle::SP_BrowserReload), tr("&Reload"), m_view, SLOT(reload()));
    m_actionReload->setShortcut(QKeySequence("F5"));
    m_menuView->addSeparator();
    m_menuView->addAction(QIcon::fromTheme("zoom-in"), tr("Zoom &In"), m_view, SLOT(zoomIn()))->setShortcut(QKeySequence("Ctrl++"));
    m_menuView->addAction(QIcon::fromTheme("zoom-out"), tr("Zoom &Out"), m_view, SLOT(zoomOut()))->setShortcut(QKeySequence("Ctrl+-"));
    m_menuView->addAction(QIcon::fromTheme("zoom-original"), tr("Reset"), m_view, SLOT(zoomReset()))->setShortcut(QKeySequence("Ctrl+0"));
    m_menuView->addSeparator();
    m_menuView->addAction(QIcon::fromTheme("text-html"), tr("&Page Source"), m_view, SLOT(showSource()))->setShortcut(QKeySequence("Ctrl+U"));
    m_menuBar->addMenu(m_menuView);

    // Make shortcuts available even with hidden menubar
    QList<QAction*> actions = m_menuBar->actions();
    foreach(QAction * action, actions) {
        if (action->menu()) {
            actions += action->menu()->actions();
        }
        addAction(action);
    }

    m_layout->insertWidget(0, m_menuBar);
    m_layout->addWidget(m_locationBar);
    m_layout->addWidget(m_view);
    m_layout->addWidget(m_statusBar);
    setLayout(m_layout);

    connect(m_view, SIGNAL(showNotification(QWidget*)), this, SLOT(showNotification(QWidget*)));
    connect(m_view, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged()));
    connect(m_view, SIGNAL(urlChanged(QUrl)), m_locationBar, SLOT(showUrl(QUrl)));
    connect(m_view, SIGNAL(iconChanged()), m_locationBar, SLOT(showIcon()));
    connect(m_view, SIGNAL(statusBarMessage(QString)), this, SLOT(showStatusBarMessage(QString)));
    connect(m_view, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
    connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int)));
    connect(m_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));

    connect(m_page, SIGNAL(linkHovered(QString, QString, QString)), this, SLOT(showStatusBarMessage(QString)));
    connect(m_page, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(setWindowGeometry(QRect)));
    connect(m_page, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(setStatusBarVisibility(bool)));
    connect(m_page, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(setMenuBarVisibility(bool)));
    connect(m_page, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(setToolBarVisibility(bool)));

    m_view->setFocus();
    titleChanged();

    QUrl urlToShow = m_view->url();
    if (urlToShow.isEmpty()) {
        urlToShow = m_view->page()->mainFrame()->requestedUrl();
    }

    m_locationBar->showUrl(urlToShow);

    // Ensuring correct sizes for widgets in layout are calculated even
    // before calling QWidget::show()
    m_layout->invalidate();
    m_layout->activate();
}
Beispiel #29
0
void WebViewHtmlWidget::webLinkHovered(const QString &link, const QString&, const QString&)
{
    emit linkHovered(QUrl(link));
}
Beispiel #30
0
void MessageView::partLinkHovered(const QString &link, const QString &title, const QString &textContent)
{
    Q_UNUSED(title);
    Q_UNUSED(textContent);
    emit linkHovered(link);
}