예제 #1
0
bool KHTMLSideBar::urlSelected( const QString &url, int button,
                                int state, const QString &_target,
                                const KParts::OpenUrlArguments& args,
                                const KParts::BrowserArguments& browserArgs )
{
    if (button == Qt::LeftButton ) {
        if (_target.toLower() == "_self") {
            openUrl(url);
        } else if (_target.toLower() == "_blank") {
            emit openUrlNewWindow(completeURL(url).url(), args);
        } else { // isEmpty goes here too
            emit openUrlRequest(completeURL(url).url(), args);
        }
        return true;
    }
    if (button == Qt::MidButton) {
        emit openUrlNewWindow(completeURL(url).url(),
                              args);
        return true;
    }
    // A refresh
    if (button == 0 && _target.toLower() == "_self") {
        openUrl(completeURL(url));
        return true;
    }
    return KHTMLPart::urlSelected(url, button, state, _target, args, browserArgs);
}
예제 #2
0
void HistoryMenu::showHistoryDialog()
{
    HistoryDialog *dialog = new HistoryDialog(this);
    connect(dialog, SIGNAL(openUrl(QUrl)),
            this, SIGNAL(openUrl(QUrl)));
    dialog->show();
}
예제 #3
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 Document Browser"));
    QStringList paths;
    paths << 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(highlighted(QUrl)),this,SLOT(highlighted(QUrl)));

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

    m_liteApp->extension()->addObject("LiteApi.ILiteDoc",this);

    QUrl url("/readme.html");
    openUrl(url);
}
예제 #4
0
void SidebarWidget::openPanel(const QString &identifier)
{
	QWidget *widget = NULL;

	if (identifier.isEmpty())
	{
		widget = NULL;
	}
	else if (identifier == QLatin1String("bookmarks") || identifier == QLatin1String("cache") || identifier == QLatin1String("config") || identifier == QLatin1String("cookies") || identifier == QLatin1String("history") || identifier == QLatin1String("transfers"))
	{
		Window *window = new Window(false, NULL, this);
		window->setUrl(QLatin1String("about:") + identifier, false);

		connect(window, SIGNAL(requestedOpenUrl(QUrl,OpenHints)), this, SLOT(openUrl(QUrl,OpenHints)));

		widget = window;
	}
	else if (identifier.startsWith(QLatin1String("web:")))
	{
		Window *window = new Window(false, NULL, this);
		window->setUrl(identifier.section(':', 1, -1));

		connect(window, SIGNAL(requestedOpenUrl(QUrl,OpenHints)), this, SLOT(openUrl(QUrl,OpenHints)));

		widget = window;
	}

	if (m_currentWidget)
	{
		QWidget *currentWidget = m_currentWidget;

		m_currentWidget = NULL;

		layout()->removeWidget(currentWidget);

		currentWidget->deleteLater();
	}

	if (m_buttons.contains(m_currentPanel) && m_buttons[m_currentPanel])
	{
		m_buttons[m_currentPanel]->setChecked(false);
	}

	if (widget)
	{
		layout()->addWidget(widget);

		if (m_buttons.contains(identifier) && m_buttons[identifier])
		{
			m_buttons[identifier]->setChecked(true);
		}
	}

	m_currentPanel = identifier;
	m_currentWidget = widget;

	updateSize();
}
예제 #5
0
ModelMenu *BookmarksToolBar::createMenu()
{
    BookmarksMenu *menu = new BookmarksMenu(this);
    connect(menu, SIGNAL(openUrl(const QUrl&, const QString&)),
            this, SIGNAL(openUrl(const QUrl&, const QString&)));
    connect(menu, SIGNAL(openUrl(QUrl,TabWidget::OpenUrlIn,QString)),
            this, SIGNAL(openUrl(QUrl,TabWidget::OpenUrlIn,QString)));
    return menu;
}
예제 #6
0
PanelTreeView::PanelTreeView(QWidget *parent)
    : QTreeView(parent)
{
    connect(this, SIGNAL(itemHovered(QString)), parent, SIGNAL(itemHovered(QString)));
    connect(this, SIGNAL(openUrl(KUrl,Rekonq::OpenType)), parent, SIGNAL(openUrl(KUrl,Rekonq::OpenType)));
    
    setMouseTracking(true);
    setExpandsOnDoubleClick(false);
}
예제 #7
0
void FeedWidget::addEntry( QSharedPointer<Entry> entry )
{
    Tile *tile = createTile( mPlayer, nullptr, entry );
    if( tile ) {
        mLayout->addWidget( tile );
        mTiles.push_back( tile );

        connect( tile, SIGNAL(openUrl(QString)), SIGNAL(openUrl(QString)) );
    }
}
예제 #8
0
TestKHTML::TestKHTML()
    : KXmlGuiWindow()
{
#ifndef __KDE_HAVE_GCC_VISIBILITY
    m_factory = new KHTMLGlobal();
#endif

    m_movie = new QMovie(":/pics/progress.gif");
    m_indicator = new QLabel;
    m_indicator->setFixedSize(QSize(24, 24));
    m_indicator->setMovie(m_movie);

    m_part = new KHTMLPart( this, this, KHTMLPart::BrowserViewGUI );
    connect( m_part->browserExtension(), SIGNAL(openUrlRequest(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)),
             this, SLOT(openUrl(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)));

    m_combo = new KComboBox;
    m_combo->setEditable(true);
    connect(m_combo, SIGNAL(returnPressed(QString)), this, SLOT(openUrl(QString)));

    m_goButton = new QToolButton;
    m_goButton->setText("Go");
    connect(m_goButton, SIGNAL(clicked()), this, SLOT(openUrl()));

    m_reloadButton = new QToolButton;
    m_reloadButton->setIcon(KIcon("view-refresh"));
    connect(m_reloadButton, SIGNAL(clicked()), this, SLOT(reload()));

    QHBoxLayout *topLayout = new QHBoxLayout;
    topLayout->addWidget(m_reloadButton);
    topLayout->addWidget(m_combo);
    topLayout->addWidget(m_goButton);
    topLayout->addWidget(m_indicator);
    m_indicator->show();

    QFrame *mainWidget = new QFrame;
    QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget);
    mainLayout->addLayout(topLayout);
    mainLayout->addWidget(m_part->widget());

    setCentralWidget(mainWidget);
    resize(800, 600);
    setupActions();

    m_part->setJScriptEnabled(true);
    m_part->setJavaEnabled(true);
    m_part->setPluginsEnabled(true);
    m_part->setURLCursor(QCursor(Qt::PointingHandCursor));

    connect(m_part, SIGNAL(setWindowCaption(QString)),
            m_part->widget()->topLevelWidget(), SLOT(setCaption(QString)));

    connect(m_part, SIGNAL(started(KIO::Job*)), this, SLOT(startLoading()));
    connect(m_part, SIGNAL(completed()), this, SLOT(finishedLoading()));
}
예제 #9
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();
}
예제 #10
0
NotesContentsWidget::NotesContentsWidget(Window *window) : ContentsWidget(window),
	m_ui(new Ui::NotesContentsWidget)
{
	m_ui->setupUi(this);

	QMenu *addMenu(new QMenu(m_ui->addButton));
	addMenu->addAction(ThemesManager::getIcon(QLatin1String("inode-directory")), tr("Add Folder"), this, SLOT(addFolder()));
	addMenu->addAction(tr("Add Note"), this, SLOT(addNote()));
	addMenu->addAction(tr("Add Separator"), this, SLOT(addSeparator()));

	m_ui->addButton->setMenu(addMenu);
	m_ui->notesViewWidget->setViewMode(ItemViewWidget::TreeViewMode);
	m_ui->notesViewWidget->setModel(NotesManager::getModel());
	m_ui->notesViewWidget->setExpanded(NotesManager::getModel()->getRootItem()->index(), true);
	m_ui->notesViewWidget->setFilterRoles(QSet<int>({BookmarksModel::UrlRole, BookmarksModel::TitleRole, BookmarksModel::DescriptionRole, BookmarksModel::KeywordRole}));
	m_ui->notesViewWidget->viewport()->installEventFilter(this);
	m_ui->notesViewWidget->viewport()->setMouseTracking(true);
	m_ui->filterLineEdit->installEventFilter(this);
	m_ui->textEdit->setPlaceholderText(tr("Add note…"));

	if (!window)
	{
		m_ui->actionsWidget->hide();
	}

	connect(NotesManager::getModel(), SIGNAL(modelReset()), this, SLOT(updateActions()));
	connect(m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(removeNote()));
	connect(m_ui->addButton, SIGNAL(clicked()), this, SLOT(addNote()));
	connect(m_ui->textEdit, SIGNAL(textChanged()), this, SLOT(updateText()));
	connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)), m_ui->notesViewWidget, SLOT(setFilterString(QString)));
	connect(m_ui->notesViewWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openUrl(QModelIndex)));
	connect(m_ui->notesViewWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
	connect(m_ui->notesViewWidget, SIGNAL(needsActionsUpdate()), this, SLOT(updateActions()));
}
예제 #11
0
SettingsTab::SettingsTab(const QUrl &url, TabWidget *parent)
  : AbstractTab(SETTINGS_TAB, LS(SETTINGS_TAB), parent)
{
  m_contents = new QListWidget(this);
  m_contents->setSpacing(1);
  m_contents->setFrameShape(QFrame::NoFrame);
  m_pages = new QStackedWidget(this);

  QGridLayout *mainLay = new QGridLayout(this);
  mainLay->addWidget(m_contents, 0, 0);
  mainLay->addWidget(m_pages, 0, 1);
  mainLay->setMargin(0);
  mainLay->setSpacing(0);
  mainLay->setColumnStretch(0, 1);
  mainLay->setColumnStretch(1, 4);

  QMapIterator<int, SettingsPageCreator *> i(SettingsTabHook::i()->pages());
  while (i.hasNext()) {
    i.next();
    addPage(i.value()->page(this));
  }

  m_contents->setCurrentRow(0);
  setIcon(SCHAT_ICON(Gear));
  setText(tr("Preferences"));

  connect(m_contents, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(pageChanged(QListWidgetItem*,QListWidgetItem*)));

  openUrl(url);
}
예제 #12
0
void HistoryDialog::open()
{
    QModelIndex index = tree->currentIndex();
    if (!index.parent().isValid())
        return;
    emit openUrl(index.data(HistoryModel::UrlRole).toUrl());
}
/**
 * @brief Opens the link (if any) at the current cursor position
 */
void QMarkdownTextEdit::openLinkAtCursorPosition()
{
    QTextCursor c = this->textCursor();
    int clickedPosition = c.position();

    // select the text in the clicked block and find out on which position we clicked
    c.movePosition( QTextCursor::StartOfBlock );
    int positionFromStart = clickedPosition - c.position();
    c.movePosition( QTextCursor::EndOfBlock, QTextCursor::KeepAnchor );

    QString selectedText = c.selectedText();

    // find out which url in the selected text was clicked
    QUrl url = getMarkdownUrlAtPosition( selectedText, positionFromStart );
    if ( url.isValid() )
    {
        qDebug() << __func__ << " - 'emit urlClicked( url )': " << url;
        emit urlClicked( url );

        // ignore some schemata
        if ( !_ignoredClickUrlSchemata.contains( url.scheme() ) )
        {
            // open the url
            openUrl( url );
        }
    }
}
예제 #14
0
MyMultiEdit::MyMultiEdit (QWidget* parent, const char* name)
  : QMultiLineEdit(parent, name)
{
  initMetaObject();
  web_menu = new CPopupMenu;
  web_menu->insertItem(klocale->translate("Open URL"), this, SLOT(openUrl()) );
}
예제 #15
0
NamingDialog::NamingDialog(Screenshot::Naming naming,QWidget *parent) :
    QDialog(parent)
{
  ui.setupUi(this);
  setModal(true);
  setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);

  ui.dateFormatComboBox->installEventFilter(this);

  // Settings
  QSettings *s = ScreenshotManager::instance()->settings();
  ui.flipNamingCheckBox->setChecked(s->value("options/flip", false).toBool());

  ui.dateFormatComboBox->setCurrentIndex(
        ui.dateFormatComboBox->findText(s->value("options/naming/dateFormat", "yyyy-MM-dd").toString())
        );

  if (ui.dateFormatComboBox->currentIndex() == -1) {
    ui.dateFormatComboBox->addItem(s->value("options/naming/dateFormat", "yyyy-MM-dd").toString());
    ui.dateFormatComboBox->setCurrentIndex(ui.dateFormatComboBox->count()-1);
  }

  ui.leadingZerosSpinBox->setValue(s->value("options/naming/leadingZeros", 0).toInt());

  // Signals/Slots
  connect(ui.buttonBox    , SIGNAL(accepted()),             this, SLOT(saveSettings()));
  connect(ui.dateHelpLabel, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString)));

  // Stack & window size adjustments
  ui.stack->setCurrentIndex((int)naming);
  ui.stack->currentWidget()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);

  resize(minimumSizeHint());
}
예제 #16
0
void UrlOpener::openEmail(const QByteArray &email)
{
	QString client;

	bool useDefaultEMailClient = m_configuration->deprecatedApi()->readBoolEntry("Chat", "UseDefaultEMailClient", true);
	if (!useDefaultEMailClient)
		client = m_configuration->deprecatedApi()->readEntry("Chat", "MailClient");

	QByteArray urlForDesktopServices;
	QByteArray urlForApplication;
	if (email.startsWith("mailto:"))
	{
		urlForDesktopServices = email;
		urlForApplication = email;
		urlForApplication.remove(0, 7);
	}
	else
	{
		urlForDesktopServices = "mailto:" + email;
		urlForApplication = email;
	}

	if (!openUrl(urlForDesktopServices, urlForApplication, client))
		MessageDialog::show(m_iconsManager->iconByPath(KaduIcon("dialog-error")), QCoreApplication::translate("@default", QT_TR_NOOP("Kadu")),
				QCoreApplication::translate("@default", QT_TR_NOOP("Could not spawn Mail client process. Check if the Mail client is functional")));
}
예제 #17
0
파일: bookmarks.cpp 프로젝트: RobinWuDev/Qt
void BookmarksDialog::open()
{
    QModelIndex index = tree->currentIndex();
    if (!index.parent().isValid())
        return;
    emit openUrl(index.sibling(index.row(), 1).data(BookmarksModel::UrlRole).toUrl());
}
예제 #18
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 ();
	}
예제 #19
0
파일: main.cpp 프로젝트: ideallx/Drawpile
/**
 * Handle tablet proximity events. When the eraser is brought near
 * the tablet surface, switch to eraser tool on all windows.
 * When the tip leaves the surface, switch back to whatever tool
 * we were using before.
 *
 * Also, on MacOS we must also handle the Open File event.
 */
bool DrawpileApp::event(QEvent *e) {
    if(e->type() == QEvent::TabletEnterProximity || e->type() == QEvent::TabletLeaveProximity) {
        QTabletEvent *te = static_cast<QTabletEvent*>(e);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
        if(te->pointerType()==QTabletEvent::Eraser)
            emit eraserNear(e->type() == QEvent::TabletEnterProximity);
#else
        if(e->type() == QEvent::TabletEnterProximity) {
            if(te->pointerType()==QTabletEvent::Eraser)
                emit eraserNear(true);
            else
                emit eraserNear(false);
        }
#endif
        return true;

    } else if(e->type() == QEvent::FileOpen) {
        QFileOpenEvent *fe = static_cast<QFileOpenEvent*>(e);

        // Note. This is currently broken in Qt 5.3.1:
        // https://bugreports.qt-project.org/browse/QTBUG-39972
        openUrl(fe->url());

        return true;
    }

    return QApplication::event(e);
}
예제 #20
0
파일: bookmarks.cpp 프로젝트: g2g591/arora
void BookmarksMenu::activated(const QModelIndex &index)
{
    emit openUrl(
          index.data(BookmarksModel::UrlRole).toUrl(),
          TabWidget::CurrentTab,
          index.data(Qt::DisplayRole).toString());
}
예제 #21
0
void OAuthWizard::authorize()
{
  ui_p->pinEdit->setEnabled( false );
  QOAuth::ParamMap otherArgs;
  otherArgs.insert( ParamVerifier, ui_p->pinEdit->text().toAscii() );
  QOAuth::ParamMap accessToken = qoauth->accessToken( TwitterAccessTokenURL, QOAuth::POST, token,
                                                      tokenSecret, QOAuth::HMAC_SHA1, otherArgs );

  if ( qoauth->error() != QOAuth::NoError ) {
    ui_p->pinEdit->hide();
    ui_p->pinLabel->setText( tr( "Either the PIN you entered is incorrect, or a network-related problem occured. Please try again later." ) );
    ui_p->okButton->setText( tr( "Retry" ) );
    adjustSize();
    resize( width(), height() * 1.5 );
    disconnect( ui_p->okButton, SIGNAL(clicked()), this, SLOT(authorize()) );
    connect( ui_p->okButton, SIGNAL(clicked()), this, SLOT(openUrl()) );
    state = false;
    return;
  }

  screenName = accessToken.value( ParamScreenName );
  token = accessToken.value( QOAuth::ParamToken );
  tokenSecret = accessToken.value( QOAuth::ParamTokenSecret );
  state = true;
  accept();
}
예제 #22
0
파일: mainwindow.cpp 프로젝트: thomrou/adso
//! [1]
void MainWindow::createActions()
{
    openAct = new QAction(tr("&Open..."), this);
    openAct->setShortcut(tr("Ctrl+O"));
    openAct->setStatusTip(tr("Open an existing HTML file"));
    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

    openUrlAct = new QAction(tr("&Open URL..."), this);
    openUrlAct->setShortcut(tr("Ctrl+U"));
    openUrlAct->setStatusTip(tr("Open a URL"));
    connect(openUrlAct, SIGNAL(triggered()), this, SLOT(openUrl()));
//! [1]

    saveAct = new QAction(tr("&Save"), this);
    saveAct->setShortcut(tr("Ctrl+S"));
    saveAct->setStatusTip(tr("Save the HTML file to disk"));
    connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));

    exitAct = new QAction(tr("E&xit"), this);
    exitAct->setStatusTip(tr("Exit the application"));
    exitAct->setShortcut(tr("Ctrl+Q"));
    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

    aboutAct = new QAction(tr("&About"), this);
    aboutAct->setStatusTip(tr("Show the application's About box"));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

}
예제 #23
0
void HistoryPanel::openAll()
{
    QModelIndex index = panelTreeView()->currentIndex();
    if (!index.isValid())
        return;

    QList<KUrl> allChild;

    for (int i = 0; i < index.model()->rowCount(index); i++)
        allChild << qVariantValue<KUrl>(index.child(i, 0).data(Qt::UserRole));

    if (allChild.length() > 8)
    {
        if (!(KMessageBox::warningContinueCancel(this,
                i18ncp("%1=Number of tabs. Value is always >=8",
                       "You are about to open %1 tabs.\nAre you sure?",
                       "You are about to open %1 tabs.\nAre you sure?",
                       allChild.length())) == KMessageBox::Continue)
           )
            return;
    }

    for (int i = 0; i < allChild.length(); i++)
        emit openUrl(allChild.at(i).url(), Rekonq::NewTab);
}
예제 #24
0
void UrlOpener::openEmail(const QByteArray &email)
{
	QString client;
	bool useDefaultEMailClient = config_file.readBoolEntry("Chat", "UseDefaultEMailClient", true);
	if (useDefaultEMailClient)
		client = config_file.readEntry("Chat", "MailClient");

	QByteArray urlForDesktopServices;
	QByteArray urlForApplication;
	if (email.startsWith("mailto:"))
	{
		urlForDesktopServices = email;
		urlForApplication = email;
		urlForApplication.remove(0, 7);
	}
	else
	{
		urlForDesktopServices = "mailto:" + email;
		urlForApplication = email;
	}

	if (!openUrl(urlForDesktopServices, urlForApplication, client))
		MessageDialog::show("dialog-error", qApp->translate("@default", QT_TR_NOOP("Kadu")),
				qApp->translate("@default", QT_TR_NOOP("Could not spawn Mail client process. Check if the Mail client is functional")));
}
예제 #25
0
void eHttpStream::thread()
{
	hasStarted();
	std::string currenturl, newurl;
	currenturl = streamUrl;
	for (unsigned int i = 0; i < 5; i++)
	{
		if (openUrl(currenturl, newurl) < 0)
		{
			/* connection failed */
			eDebug("eHttpStream::Thread end NO connection");
			connectionStatus = FAILED;
			return;
		}
		if (newurl == "")
		{
			/* we have a valid stream connection */
			eDebug("eHttpStream::Thread end connection");
			connectionStatus = CONNECTED;
			return;
		}
		/* switch to new url */
		close();
		currenturl = newurl;
		newurl = "";
	}
	/* too many redirect / playlist levels */
	eDebug("eHttpStream::Thread end NO connection");
	connectionStatus = FAILED;
	return;
}
예제 #26
0
void MainWindow::createActions() {

    openUrlAct = new QAction(tr("&Open url..."), this);
    connect(openUrlAct, SIGNAL(triggered()), this, SLOT(openUrl()));

    for (int i = 0; i < bmMap.size(); ++i) {

        //bmActList.append(new QAction(bmMap.key(i), this));
        bmActList.append(new QAction("wtf", this));

        connect(bmActList.at(i), SIGNAL(triggered()), this, SLOT(openBmUrl()));
    }

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

    homePageAct = new QAction(tr("Home page..."), this);
    connect(homePageAct, SIGNAL(triggered()), this, SLOT(setHomePage()));

    aboutAct = new QAction(tr("&About"), this);
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

    aboutQtAct = new QAction(tr("About &Qt"), this);
    connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

    resetAct = new QAction(tr("Reset Settings"), this);
    connect(resetAct, SIGNAL(triggered()), this, SLOT(resetSettings()));

}
예제 #27
0
void GPSTrackListWidget::resized()
{
    QString url = d->gpsTrackListUrl;
    url.append("?width=");
    url.append(QString::number(view()->width()));
    url.append("&height=");
    url.append(QString::number(view()->height()));
    url.append("&zoom=");
    url.append(d->zoomLevel);
    url.append("&maptype=");
    url.append(d->mapType);

    int count = d->gpsTrackList.count();
    url.append("&items=");
    url.append(QString::number(count));
    for( GPSTrackList::iterator it = d->gpsTrackList.begin() ;
         it != d->gpsTrackList.end() ; ++it)
    {
        int id = it.value().id();
        url.append(QString("&lat%1=").arg(id));
        url.append(QString::number(it.value().gpsData().latitude()));
        url.append(QString("&lng%1=").arg(id));
        url.append(QString::number(it.value().gpsData().longitude()));
        url.append(QString("&alt%1=").arg(id));
        url.append(QString::number(it.value().gpsData().altitude()));
        url.append(QString("&title%1=").arg(id));
        url.append(QString("%1").arg(id));
    }

    openUrl(KUrl(url));
    kDebug( 51001 ) << url << endl;
}
예제 #28
0
파일: docpart.cpp 프로젝트: fagu/kileip
bool DocumentationViewer::urlSelected(const QString &url, int button, int state, const QString &_target, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments & /* browserArgs */)
{
	KUrl cURL = completeURL(url);
	QString mime = KMimeType::findByUrl(cURL).data()->name();

	//load this URL in the embedded viewer if KHTML can handle it, or when mimetype detection failed
	KService::Ptr service = KService::serviceByDesktopName("khtml");
	if(( mime == KMimeType::defaultMimeType() ) || (service && service->hasServiceType(mime))) {
		KHTMLPart::urlSelected(url, button, state, _target, args);
		openUrl(cURL);
		addToHistory(cURL.url());
	}
	//KHTML can't handle it, look for an appropriate application
	else {
		KService::List offers = KMimeTypeTrader::self()->query(mime, "Type == 'Application'");
		if(offers.isEmpty()) {
			KMessageBox::error(view(), i18n("No KDE service found for the MIME type \"%1\".", mime));
			return false;
		}
		KUrl::List lst;
		lst.append(cURL);
		KRun::run(*(offers.first()), lst, view());
	}
	return true;
}
예제 #29
0
파일: bookmarks.cpp 프로젝트: RobinWuDev/Qt
void BookmarksToolBar::triggered(QAction *action)
{
    QVariant v = action->data();
    if (v.canConvert<QUrl>()) {
        emit openUrl(v.toUrl());
    }
}
예제 #30
0
void BrowserApplication::newLocalSocketConnection()
{
    QLocalSocket *socket = m_localServer->nextPendingConnection();
    if (!socket)
        return;
    socket->waitForReadyRead(1000);
    QDataStream stream(socket);
    QSharedDataPointer<ProcessOptions> processOptions(new ProcessOptions());
    stream >> *processOptions;
    QString url = processOptions->url;
    if (!url.isEmpty()) {
        QSettings settings;
        settings.beginGroup(QLatin1String("general"));
        int openLinksIn = settings.value(QLatin1String("openLinksIn"), 0).toInt();
        settings.endGroup();
        if (openLinksIn == 1)
            newMainWindow(processOptions);
        else {
            mainWindow()->tabWidget()->newTab(processOptions);
        }
        openUrl(url);
    }
    delete socket;
    mainWindow()->raise();
    mainWindow()->activateWindow();
}