Exemple #1
0
	void TermTab::AddUrlActions (QMenu& menu, const QPoint& point)
	{
		const auto hotspot = Term_->getHotSpotAt (point);
		if (!hotspot)
			return;

		if (hotspot->type () != Filter::HotSpot::Link)
			return;

		const auto urlHotSpot = dynamic_cast<const Konsole::UrlFilter::HotSpot*> (hotspot);
		if (!urlHotSpot)
			return;

		const auto& cap = urlHotSpot->capturedTexts ().value (0);
		if (cap.isEmpty ())
			return;

		const auto itm = CoreProxy_->GetIconThemeManager ();
		const auto openAct = menu.addAction (itm->GetIcon ("document-open-remote"),
				tr ("Open URL"),
				this,
				SLOT (openUrl ()));
		openAct->setProperty ("ER/Url", cap);

		const auto copyAct = menu.addAction (tr ("Copy URL"),
				this,
				SLOT (copyUrl ()));
		copyAct->setProperty ("ER/Url", cap);

		menu.addSeparator ();
	}
void HistoryManager::createContextMenu(const QPoint &pos)
{
    QMenu menu;
    QAction* actNewTab = menu.addAction(IconProvider::newTabIcon(), tr("Open in new tab"));
    QAction* actNewWindow = menu.addAction(IconProvider::newWindowIcon(), tr("Open in new window"));
    QAction* actNewPrivateWindow = menu.addAction(IconProvider::privateBrowsingIcon(), tr("Open in new private window"));

    menu.addSeparator();
    QAction* actCopyUrl = menu.addAction(tr("Copy url"), this, SLOT(copyUrl()));
    QAction* actCopyTitle = menu.addAction(tr("Copy title"), this, SLOT(copyTitle()));

    menu.addSeparator();
    QAction* actDelete = menu.addAction(QIcon::fromTheme(QSL("edit-delete")), tr("Delete"));

    connect(actNewTab, SIGNAL(triggered()), this, SLOT(openUrlInNewTab()));
    connect(actNewWindow, SIGNAL(triggered()), this, SLOT(openUrlInNewWindow()));
    connect(actNewPrivateWindow, SIGNAL(triggered()), this, SLOT(openUrlInNewPrivateWindow()));
    connect(actDelete, SIGNAL(triggered()), ui->historyTree, SLOT(removeSelectedItems()));

    if (ui->historyTree->selectedUrl().isEmpty()) {
        actNewTab->setDisabled(true);
        actNewWindow->setDisabled(true);
        actNewPrivateWindow->setDisabled(true);
        actCopyTitle->setDisabled(true);
        actCopyUrl->setDisabled(true);
    }

    menu.exec(pos);
}
Exemple #3
0
void SearchPage::showBrowserContextMenu(const QPoint &pos) {
    const QWebHitTestResult result = m_browser->page()->mainFrame()->hitTestContent(pos);
    const QString url = result.linkUrl().toString();

    if (url.isEmpty()) {
        return;
    }

    QMenu menu(this);
    QAction *copyAction = menu.addAction(QIcon::fromTheme("edit-copy"), tr("&Copy URL"));
    QAction *addAction = menu.addAction(QIcon::fromTheme("list-add"), tr("&Add URL"));
    QAction *retrieveAction = menu.addAction(QIcon::fromTheme("folder-remote"), tr("&Retrieve URLs"));
    QAction *downloadAction = menu.addAction(QIcon::fromTheme("download"), tr("Retrieve &download requests"));
    QAction *action = menu.exec(m_browser->mapToGlobal(pos));
    
    if (!action) {
        return;
    }
    
    if (action == copyAction) {
        copyUrl(url);
    }
    else if (action == addAction) {
        addUrl(url);
    }
    else if (action == retrieveAction) {
        retrieveUrls(url);
    }
    else if (action == downloadAction) {
        fetchDownloadRequests(url);
    }
}
Exemple #4
0
void SearchPage::showContextMenu(const QPoint &pos) {
    const QModelIndex index = m_view->currentIndex();
    
    if (!index.isValid()) {
        return;
    }
    
    QMenu menu(this);
    QAction *copyAction = menu.addAction(QIcon::fromTheme("edit-copy"), tr("&Copy URL"));
    QAction *addAction = menu.addAction(QIcon::fromTheme("list-add"), tr("&Add URL"));
    QAction *retrieveAction = menu.addAction(QIcon::fromTheme("folder-remote"), tr("&Retrieve URLs"));
    QAction *downloadAction = menu.addAction(QIcon::fromTheme("download"), tr("Retrieve &download requests"));
    QAction *action = menu.exec(m_view->mapToGlobal(pos));
    
    if (!action) {
        return;
    }
    
    if (action == copyAction) {
        copyUrl(index.data(SearchModel::UrlRole).toString());
    }
    else if (action == addAction) {
        addUrl(index.data(SearchModel::UrlRole).toString());
    }
    else if (action == retrieveAction) {
        retrieveUrls(index.data(SearchModel::UrlRole).toString());
    }
    else if (action == downloadAction) {
        fetchDownloadRequests(index.data(SearchModel::UrlRole).toString());
    }
}
Exemple #5
0
void TextLabelWidget::contextMenuEvent(QContextMenuEvent *event)
{
	QMenu menu(this);
	menu.addAction(tr("Copy"), this, SLOT(copy()), QKeySequence(QKeySequence::Copy))->setEnabled(hasSelectedText());

	if (m_url.isValid())
	{
		menu.addAction(tr("Copy Link Location"), this, SLOT(copyUrl()));
	}

	menu.addSeparator();
	menu.addAction(tr("Select All"), this, SLOT(selectAll()), QKeySequence(QKeySequence::SelectAll))->setEnabled(!text().isEmpty());
	menu.exec(event->globalPos());
}
Exemple #6
0
void tpMainWindow::createActions()
{

    //tray
    open = new QAction(tr("&Open"), this);
    connect(open, SIGNAL(triggered()), this, SLOT(show()));


    close = new QAction(tr("&Quit"), this);
    connect(close, SIGNAL(triggered()), this, SLOT(myQuit()));

    open_in_browser = new QAction(tr("&Open in Browser"), this);
    connect(open_in_browser, SIGNAL(triggered()), this, SLOT(openStreamBrowser()));


    open_in_hexchat = new QAction(tr("Open &Chat"), this);
    connect(open_in_hexchat, SIGNAL(triggered()), this, SLOT(openChatHexChat()));

    open_in_hexchat_bookmark = new QAction(tr("Open &Chat"), this);
    connect(open_in_hexchat_bookmark, SIGNAL(triggered()), this, SLOT(openChatHexChatBookmark()));


    open_in_browser_bookmark = new QAction(tr("&Open in Browser"), this);
    connect(open_in_browser_bookmark, SIGNAL(triggered()), this, SLOT(openStreamBrowserBookmark()));

    add_hosted_bookmark = new QAction(tr("&Add Hosted to Bookmarks"), this);
    connect(add_hosted_bookmark, SIGNAL(triggered()), this, SLOT(addBookmarkHosted()));

    delete_bookmark = new QAction(tr("&Remove"), this);
    connect(delete_bookmark, SIGNAL(triggered()), this, SLOT(deleteBookmark()));

    add_bookmark = new QAction(tr("&Add"), this);
    connect(add_bookmark, SIGNAL(triggered()), this, SLOT(addBookmark()));

    add_follow = new QAction(tr("&Follow Channel..."), this);
    connect(add_follow, SIGNAL(triggered()), this, SLOT(addFollow()));

    add_follower_bookmark = new QAction(tr("Follow Channel"), this);
    connect(add_follower_bookmark, SIGNAL(triggered()), this, SLOT(addFollowerBookmark()));

    delete_follower = new QAction(tr("Unfollow Channel"), this);
    connect(delete_follower, SIGNAL(triggered()), this, SLOT(deleteFollower()));

    copy_streamurl = new QAction(tr("Copy URL"), this);
    copy_streamurl->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
    connect(copy_streamurl, SIGNAL(triggered()), this, SLOT(copyUrl()));

}
void HistoryManager::contextMenuRequested(const QPoint &position)
{
    if (!ui->historyTree->itemAt(position)) {
        return;
    }
    QUrl link = QUrl::fromEncoded(ui->historyTree->itemAt(position)->text(1).toUtf8());
    if (link.isEmpty()) {
        return;
    }

    QMenu menu;
    menu.addAction(tr("Open link in current tab"), getQupZilla(), SLOT(loadActionUrl()))->setData(link);
    menu.addAction(tr("Open link in new tab"), this, SLOT(loadInNewTab()))->setData(link);
    menu.addSeparator();
    menu.addAction(tr("Copy address"), this, SLOT(copyUrl()))->setData(link);

    //Prevent choosing first option with double rightclick
    QPoint pos = QCursor::pos();
    QPoint p(pos.x(), pos.y() + 1);
    menu.exec(p);
}
Exemple #8
0
void PageNetServer::connectSignals()
{
    connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort()));
    connect(BtnShare, SIGNAL(clicked()), this, SLOT(copyUrl()));
}
Exemple #9
0
NetStatus::NetStatus(QWidget *parent)
	: QWidget(parent), _sentbytes(0), _recvbytes(0), _lag(0)
{
	setMinimumHeight(16+2);

	QHBoxLayout *layout = new QHBoxLayout(this);
	layout->setMargin(1);
	layout->setSpacing(4);

	// Download progress bar
	m_download = new QProgressBar(this);
	m_download->setMaximumWidth(120);
	m_download->setSizePolicy(QSizePolicy());
	m_download->setTextVisible(false);
	m_download->setMaximum(100);
	m_download->hide();
	layout->addWidget(m_download);

	// Host address label
	_label = new QLabel(tr("not connected"), this);
	_label->setTextInteractionFlags(
			Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard
			);
	_label->setCursor(Qt::IBeamCursor);
	_label->setContextMenuPolicy(Qt::ActionsContextMenu);
	layout->addWidget(_label);

	// Action to copy address to clipboard
	_copyaction = new QAction(tr("Copy address to clipboard"), this);
	_copyaction->setEnabled(false);
	_label->addAction(_copyaction);
	connect(_copyaction,SIGNAL(triggered()),this,SLOT(copyAddress()));

	// Action to copy the full session URL to clipboard
	_urlaction = new QAction(tr("Copy session URL to clipboard"), this);
	_urlaction->setEnabled(false);
	_label->addAction(_urlaction);
	connect(_urlaction, SIGNAL(triggered()), this, SLOT(copyUrl()));

	// Discover local IP address
	_discoverIp = new QAction(tr("Get externally visible IP address"), this);
	_discoverIp->setVisible(false);
	_label->addAction(_discoverIp);
	connect(_discoverIp, SIGNAL(triggered()), this, SLOT(discoverAddress()));
	connect(WhatIsMyIp::instance(), SIGNAL(myAddressIs(QString)), this, SLOT(externalIpDiscovered(QString)));

#ifdef HAVE_UPNP
	connect(net::UPnPClient::instance(), SIGNAL(externalIp(QString)), this, SLOT(externalIpDiscovered(QString)));
#endif

	// Show network statistics
	QAction *sep = new QAction(this);
	sep->setSeparator(true);
	_label->addAction(sep);

	QAction *showNetStats = new QAction(tr("Statistics"), this);
	_label->addAction(showNetStats);
	connect(showNetStats, SIGNAL(triggered()), this, SLOT(showNetStats()));

	// Security level icon
	_security = new QLabel(QString(), this);
	_security->setFixedSize(QSize(16, 16));
	_security->hide();
	layout->addWidget(_security);

	_security->setContextMenuPolicy(Qt::ActionsContextMenu);

	QAction *showcert = new QAction(tr("Show certificate"), this);
	_security->addAction(showcert);
	connect(showcert, SIGNAL(triggered()), this, SLOT(showCertificate()));

	// Low space alert
	m_lowspace = new QLabel(tr("Low space!"), this);
	m_lowspace->setToolTip(tr("Server is almost out of space for session history! Reset the session to free some up."));
	QPalette lowSpacePalette = m_lowspace->palette();
	lowSpacePalette.setColor(QPalette::WindowText, Qt::red);
	m_lowspace->setPalette(lowSpacePalette);
	m_lowspace->setVisible(false);
	layout->addWidget(m_lowspace);

	// Popup label
	m_popup = new PopupMessage(this);

	// Some styles are buggy and have bad tooltip colors, so we force the colors here.
	QPalette popupPalette;
	popupPalette.setColor(QPalette::ToolTipBase, Qt::black);
	popupPalette.setColor(QPalette::ToolTipText, Qt::white);
	m_popup->setPalette(popupPalette);
}
Exemple #10
0
NetStatus::NetStatus(QWidget *parent)
    : QWidget(parent), _sentbytes(0), _recvbytes(0), _activity(0)
{
    setMinimumHeight(16+2);

    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setMargin(1);
    layout->setSpacing(4);

    // Data transfer progress (not always shown)
    QVBoxLayout *progresslayout = new QVBoxLayout;
    progresslayout->setContentsMargins(0, 0, 0 ,0);
    progresslayout->setSpacing(0);

    // Upload progress bar
    _upload = new QProgressBar(this);
    _upload->setMaximumWidth(120);
    _upload->setSizePolicy(QSizePolicy());
    _upload->setTextVisible(false);
    _upload->hide();
    {
        // Red progress bar for upload
        QPalette pal = _upload->palette();
        pal.setColor(QPalette::Highlight, QColor(198, 48, 48));
        _upload->setPalette(pal);
    }
    progresslayout->addWidget(_upload);

    // Download progress bar
    _download = new QProgressBar(this);
    _download->setMaximumWidth(120);
    _download->setSizePolicy(QSizePolicy());
    _download->setTextVisible(false);
    _download->hide();
    {
        // Blue progress bar for download
        QPalette pal = _upload->palette();
        pal.setColor(QPalette::Highlight, QColor(48, 140, 198));
        _download->setPalette(pal);
    }
    progresslayout->addWidget(_download);

    layout->addLayout(progresslayout);

    // Host address label
    _label = new QLabel(tr("not connected"), this);
    _label->setTextInteractionFlags(
        Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard
    );
    _label->setCursor(Qt::IBeamCursor);
    _label->setContextMenuPolicy(Qt::ActionsContextMenu);
    layout->addWidget(_label);

    // Action to copy address to clipboard
    _copyaction = new QAction(tr("Copy address to clipboard"), this);
    _copyaction->setEnabled(false);
    _label->addAction(_copyaction);
    connect(_copyaction,SIGNAL(triggered()),this,SLOT(copyAddress()));

    // Action to copy the full session URL to clipboard
    _urlaction = new QAction(tr("Copy session URL to clipboard"), this);
    _urlaction->setEnabled(false);
    _label->addAction(_urlaction);
    connect(_urlaction, SIGNAL(triggered()), this, SLOT(copyUrl()));

    // Discover local IP address
    _discoverIp = new QAction(tr("Get externally visible IP address"), this);
    _discoverIp->setVisible(false);
    _label->addAction(_discoverIp);
    connect(_discoverIp, SIGNAL(triggered()), this, SLOT(discoverAddress()));
    connect(WhatIsMyIp::instance(), SIGNAL(myAddressIs(QString)), this, SLOT(externalIpDiscovered(QString)));

    // Network connection status icon
    _icon = new QLabel(QString(), this);
    _icon->setFixedSize(QSize(16, 16));
    _icon->hide();
    layout->addWidget(_icon);

    // Security level icon
    _security = new QLabel(QString(), this);
    _security->setFixedSize(QSize(16, 16));
    _security->hide();
    layout->addWidget(_security);

    _security->setContextMenuPolicy(Qt::ActionsContextMenu);

    QAction *showcert = new QAction(tr("Show certificate"), this);
    _security->addAction(showcert);
    connect(showcert, SIGNAL(triggered()), this, SLOT(showCertificate()));

    // Popup label
    _popup = new PopupMessage(this);

    // Some styles are buggy and have bad tooltip colors, so we force the colors here.
    QPalette popupPalette;
    popupPalette.setColor(QPalette::ToolTipBase, Qt::black);
    popupPalette.setColor(QPalette::ToolTipText, Qt::white);
    _popup->setPalette(popupPalette);

    // Timer for activity update
    _timer = new QTimer(this);
    _timer->setSingleShot(true);
    connect(_timer, SIGNAL(timeout()), this, SLOT(updateStats()));
}
LogicPasteApp::LogicPasteApp(Application *app)
    : QObject(app), loginSheet_(NULL), ignoreSettingsEvent_(false) {
    qDebug() << "LogicPasteApp::LogicPasteApp()";
    QCoreApplication::setOrganizationName("LogicProbe");
    QCoreApplication::setApplicationName("LogicPaste");

    qRegisterMetaType<PasteListing>("PasteListing");

    pasteModel_ = new PasteModel(this);

    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    qml->setContextProperty("cs", this);
    qml->setContextProperty("model", pasteModel_);

    AppSettings *appSettings = AppSettings::instance();

    if(!qml->hasErrors()) {
        tabbedPane_ = qml->createRootObject<TabbedPane>();
        if(tabbedPane_) {
            // Paste page
            pastePage_ = tabbedPane_->findChild<Page*>("pastePage");
            connect(pastePage_, SIGNAL(submitPaste()), this, SLOT(onSubmitPaste()));
            replaceDropDown(pastePage_, "formatDropDown");

            // History page
            historyNav_ = tabbedPane_->findChild<NavigationPane*>("historyPage");
            connect(historyNav_, SIGNAL(popTransitionEnded(bb::cascades::Page*)),
                this, SLOT(onPopFinished(bb::cascades::Page*)));
            historyPage_ = historyNav_->findChild<Page*>("pasteListPage");
            connect(historyPage_, SIGNAL(refreshPage()), pasteModel_, SLOT(refreshHistory()));

            ListView *historyList = historyPage_->findChild<ListView*>("pasteList");
            historyList->setDataModel(pasteModel_->historyModel());
            connect(historyList, SIGNAL(openPaste(QString)), this, SLOT(onOpenHistoryPaste(QString)));
            connect(historyList, SIGNAL(copyUrl(QString)), this, SLOT(onCopyText(QString)));
            connect(historyList, SIGNAL(deletePaste(QString)), this, SLOT(onDeleteHistoryPaste(QString)));

            connect(pasteModel_, SIGNAL(historyUpdating()), historyPage_, SLOT(onRefreshStarted()));
            connect(pasteModel_, SIGNAL(historyUpdated(bool)), this, SLOT(onHistoryRefreshComplete(bool)));

            // Trending page
            trendingNav_ = tabbedPane_->findChild<NavigationPane*>("trendingPage");
            connect(trendingNav_, SIGNAL(popTransitionEnded(bb::cascades::Page*)),
                this, SLOT(onPopFinished(bb::cascades::Page*)));
            trendingPage_ = trendingNav_->findChild<Page*>("pasteListPage");
            trendingPage_->findChild<ActionItem*>("refreshAction")->setEnabled(true);
            connect(trendingPage_, SIGNAL(refreshPage()), pasteModel_, SLOT(refreshTrending()));

            ListView *trendingList = trendingPage_->findChild<ListView*>("pasteList");
            trendingList->setDataModel(pasteModel_->trendingModel());
            connect(trendingList, SIGNAL(openPaste(QString)), this, SLOT(onOpenTrendingPaste(QString)));
            connect(trendingList, SIGNAL(copyUrl(QString)), this, SLOT(onCopyText(QString)));

            connect(pasteModel_, SIGNAL(trendingUpdating()), trendingPage_, SLOT(onRefreshStarted()));
            connect(pasteModel_, SIGNAL(trendingUpdated(bool)), this, SLOT(onTrendingRefreshComplete(bool)));

            // Settings page
            settingsPage_ = tabbedPane_->findChild<Page*>("settingsPage");
            CheckBox *sslCheckBox = settingsPage_->findChild<CheckBox *>("sslCheckBox");
            sslCheckBox->setChecked(appSettings->useSsl());

            CheckBox *formatterEnable = settingsPage_->findChild<CheckBox*>("formatterEnable");
            formatterEnable->setChecked(appSettings->formatterEnabled());

            CheckBox *formatterLineNumbering = settingsPage_->findChild<CheckBox*>("formatterLineNumbering");
            formatterLineNumbering->setChecked(appSettings->formatterLineNumbering());

            DropDown *formatterStyle = settingsPage_->findChild<DropDown*>("formatterStyle");
            for(int i = formatterStyle->count() - 1; i >= 0; --i) {
                if(formatterStyle->at(i)->value() == appSettings->formatterStyle()) {
                    formatterStyle->setSelectedIndex(i);
                    break;
                }
            }

            connect(settingsPage_, SIGNAL(requestLogin()), this, SLOT(onRequestLogin()));
            connect(settingsPage_, SIGNAL(requestLogout()), this, SLOT(onRequestLogout()));
            connect(settingsPage_, SIGNAL(refreshUserDetails()), pasteModel_, SLOT(refreshUserDetails()));
            connect(settingsPage_, SIGNAL(connectionSettingsChanged()), this, SLOT(onConnectionSettingsChanged()));
            connect(settingsPage_, SIGNAL(pasteSettingsChanged()), this, SLOT(onPasteSettingsChanged()));
            connect(settingsPage_, SIGNAL(formatterSettingsChanged()), this, SLOT(onFormatterSettingsChanged()));
            connect(pasteModel_, SIGNAL(userDetailsUpdated()), this, SLOT(onUserDetailsUpdated()));
            connect(pasteModel_, SIGNAL(userDetailsError(QString)), this, SLOT(onUserDetailsError(QString)));
            connect(pasteModel_, SIGNAL(userAvatarUpdated()), this, SLOT(onUserAvatarUpdated()));
            connect(pasteModel_, SIGNAL(deletePasteError(PasteListing,QString)), this, SLOT(onDeletePasteError(PasteListing,QString)));

            FormatDropDown *formatDropDown = replaceDropDown(settingsPage_, "formatDropDown");
            connect(formatDropDown, SIGNAL(selectedIndexChanged(int)), this, SLOT(onPasteSettingsChanged()));

            // Tabbed pane
            connect(tabbedPane_, SIGNAL(activePaneChanged(bb::cascades::AbstractPane*)),
                this, SLOT(onActivePaneChanged(bb::cascades::AbstractPane*)));

            app->setScene(tabbedPane_);

            // Create the pull-down menu
            ActionItem *aboutItem = ActionItem::create()
            .title(tr("About"))
            .image(QUrl("asset:///images/action-about.png"));
            connect(aboutItem, SIGNAL(triggered()), this, SLOT(onAboutActionTriggered()));

            Menu *menu = Menu::create()
            .addAction(aboutItem);
            app->setMenu(menu);

            if(pasteModel_->isAuthenticated()) {
                onUserDetailsUpdated();
                onUserAvatarUpdated();
            }

            refreshPastePageDefaults();
            refreshMainActions();
        }
    }