void KexiSimplePrintPreviewWindow::slotPrintClicked()
{
    hide();
    emit printRequested();
    show();
    raise();
}
Пример #2
0
int BrowserMainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: loadPage((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 1: slotHome(); break;
        case 2: save(); break;
        case 3: slotLoadProgress((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 4: slotUpdateStatusbar((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 5: slotUpdateWindowTitle((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 6: slotUpdateWindowTitle(); break;
        case 7: loadUrl((*reinterpret_cast< const QUrl(*)>(_a[1]))); break;
        case 8: slotPreferences(); break;
        case 9: slotFileNew(); break;
        case 10: slotFileOpen(); break;
        case 11: slotFilePrintPreview(); break;
        case 12: slotFilePrint(); break;
        case 13: slotPrivateBrowsing(); break;
        case 14: slotFileSaveAs(); break;
        case 15: slotEditFind(); break;
        case 16: slotEditFindNext(); break;
        case 17: slotEditFindPrevious(); break;
        case 18: slotShowBookmarksDialog(); break;
        case 19: slotAddBookmark(); break;
        case 20: slotViewZoomIn(); break;
        case 21: slotViewZoomOut(); break;
        case 22: slotViewResetZoom(); break;
        case 23: slotViewZoomTextOnly((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 24: slotViewToolbar(); break;
        case 25: slotViewBookmarksBar(); break;
        case 26: slotViewStatusbar(); break;
        case 27: slotViewPageSource(); break;
        case 28: slotViewFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 29: slotWebSearch(); break;
        case 30: slotToggleInspector((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 31: slotAboutApplication(); break;
        case 32: slotDownloadManager(); break;
        case 33: slotSelectLineEdit(); break;
        case 34: slotAboutToShowBackMenu(); break;
        case 35: slotAboutToShowForwardMenu(); break;
        case 36: slotAboutToShowWindowMenu(); break;
        case 37: slotOpenActionUrl((*reinterpret_cast< QAction*(*)>(_a[1]))); break;
        case 38: slotShowWindow(); break;
        case 39: slotSwapFocus(); break;
        case 40: printRequested((*reinterpret_cast< QWebFrame*(*)>(_a[1]))); break;
        case 41: geometryChangeRequested((*reinterpret_cast< const QRect(*)>(_a[1]))); break;
        case 42: updateToolbarActionText((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 43: updateBookmarksToolbarActionText((*reinterpret_cast< bool(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 44;
    }
    return _id;
}
Пример #3
0
bool KexiSimplePrintingCommand::showPrintPreview(const KexiSimplePrintingSettings& settings, 
	const QString& aTitleText, bool reload)
{
	m_settings = settings;
	if (!m_previewEngine)
		m_previewEngine = new KexiSimplePrintingEngine(m_settings, this);

	if (reload)
		m_printPreviewNeedsReloading = true;

	bool backToPage0 = true;
	QString titleText(aTitleText.stripWhiteSpace());
	KexiDB::Connection *conn = m_mainWin->project()->dbConnection();
	KexiDB::TableOrQuerySchema tableOrQuery(conn, m_objectId);
	if (!tableOrQuery.table() && !tableOrQuery.query()) {
//! @todo item not found
		return false;
	}
	if (titleText.isEmpty())
		titleText = tableOrQuery.captionOrName();
	if (!m_previewWindow || m_printPreviewNeedsReloading) {
		QString errorMessage;
		if (!m_previewEngine->init(
			*conn, tableOrQuery, titleText, errorMessage)) {
			if (!errorMessage.isEmpty())
				KMessageBox::sorry(m_mainWin, errorMessage, i18n("Print Preview")); 
			return false;
		}
	}
	if (!m_previewWindow) {
		backToPage0 = false;
		m_previewWindow = new KexiSimplePrintPreviewWindow(
			*m_previewEngine, tableOrQuery.captionOrName(), 0, 
			Qt::WStyle_Customize|Qt::WStyle_NormalBorder|Qt::WStyle_Title|
			Qt::WStyle_SysMenu|Qt::WStyle_MinMax|Qt::WStyle_ContextHelp);
		connect(m_previewWindow, SIGNAL(printRequested()), this, SLOT(print()));
		connect(m_previewWindow, SIGNAL(pageSetupRequested()), this, SLOT(slotShowPageSetupRequested()));
		m_previewWindow->show();
		KDialog::centerOnScreen(m_previewWindow);
		m_printPreviewNeedsReloading = false;
	}

	if (m_printPreviewNeedsReloading) {//dirty
		m_previewEngine->clear();
//! @todo progress bar...
		m_previewEngine->setTitleText( titleText );
		m_previewWindow->setFullWidth();
		m_previewWindow->updatePagesCount();
		m_printPreviewNeedsReloading = false;
	}
	if (backToPage0)
		m_previewWindow->goToPage(0);
	m_previewWindow->show();
	m_previewWindow->raise();
//	m_previewWindow->setPagesCount(INT_MAX); //will be properly set on demand
	return true;
}
Пример #4
0
void SecondaryWindow::print()
{
   printRequested(webView()->page()->mainFrame());
}
Пример #5
0
void MainWindow::setupActions()
{
    kDebug() << "setup actions...";

    // this let shortcuts work..
    actionCollection()->addAssociatedWidget(this);

    KAction *a;

    // new window action
    a = new KAction(KIcon("window-new"), i18n("&New Window"), this);
    a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_N));
    actionCollection()->addAction(QL1S("new_window"), a);
    connect(a, SIGNAL(triggered(bool)), Application::instance(), SLOT(newWindow()));

    // Standard Actions
    KStandardAction::open(this, SLOT(fileOpen()), actionCollection());
    KStandardAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
    KStandardAction::print(this, SLOT(printRequested()), actionCollection());
    KStandardAction::quit(this , SLOT(close()), actionCollection());

    a = KStandardAction::find(m_findBar, SLOT(show()), actionCollection());
    KShortcut findShortcut = KStandardShortcut::find();
    findShortcut.setAlternate(Qt::Key_Slash);
    a->setShortcut(findShortcut);

    KStandardAction::findNext(this, SLOT(findNext()) , actionCollection());
    KStandardAction::findPrev(this, SLOT(findPrevious()) , actionCollection());

    a = KStandardAction::fullScreen(this, SLOT(viewFullScreen(bool)), this, actionCollection());
    KShortcut fullScreenShortcut = KStandardShortcut::fullScreen();
    fullScreenShortcut.setAlternate(Qt::Key_F11);
    a->setShortcut(fullScreenShortcut);

    a = actionCollection()->addAction(KStandardAction::Home);
    connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(homePage(Qt::MouseButtons, Qt::KeyboardModifiers)));
    KStandardAction::preferences(this, SLOT(preferences()), actionCollection());

    a = KStandardAction::redisplay(m_view, SLOT(webReload()), actionCollection());
    a->setText(i18n("Reload"));
    KShortcut reloadShortcut = KStandardShortcut::reload();
    reloadShortcut.setAlternate(Qt::CTRL + Qt::Key_R);
    a->setShortcut(reloadShortcut);

    a = new KAction(KIcon("process-stop"), i18n("&Stop"), this);
    a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Period));
    actionCollection()->addAction(QL1S("stop"), a);
    connect(a, SIGNAL(triggered(bool)), m_view, SLOT(webStop()));

    // stop reload Action
    m_stopReloadAction = new KAction(this);
    actionCollection()->addAction(QL1S("stop_reload") , m_stopReloadAction);
    m_stopReloadAction->setShortcutConfigurable(false);
    connect(m_view, SIGNAL(browserTabLoading(bool)), this, SLOT(browserLoading(bool)));
    browserLoading(false); //first init for blank start page

    a = new KAction(i18n("Open Location"), this);
    KShortcut openLocationShortcut(Qt::CTRL + Qt::Key_L);
    openLocationShortcut.setAlternate(Qt::Key_F6);
    a->setShortcut(openLocationShortcut);
    actionCollection()->addAction(QL1S("open_location"), a);
    connect(a, SIGNAL(triggered(bool)) , this, SLOT(openLocation()));

    // set zoom bar actions
    m_zoomBar->setupActions(this);
    
    // tab list
    m_tabListMenu = new KMenu();
    m_tabListMenu->addAction("hack"); // necessary to show the menu on the right side the first time
    connect(m_tabListMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowTabListMenu()));
    connect(m_tabListMenu, SIGNAL(triggered(QAction*)), this, SLOT(openActionTab(QAction*)));
    KActionMenu *tabAction = new KActionMenu(i18n("Tab List"), this);
    tabAction->setMenu(m_tabListMenu);
    tabAction->setIcon(KIcon("document-multiple"));
    tabAction->setDelayed(false);
    actionCollection()->addAction(QL1S("tab_list"), tabAction);

    // =============================== Tools Actions =================================
    a = new KAction(i18n("View Page S&ource"), this);
    a->setIcon(KIcon("application-xhtml+xml"));
    a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_U));
    actionCollection()->addAction(QL1S("page_source"), a);
    connect(a, SIGNAL(triggered(bool)), this, SLOT(viewPageSource()));

    a = Application::instance()->privateBrowsingAction();
    a->setShortcut(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_P);
    actionCollection()->addAction(QL1S("private_browsing"), a);

    a = new KAction(KIcon("edit-clear"), i18n("Clear Private Data..."), this);
    a->setShortcut(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Delete);
    actionCollection()->addAction(QL1S("clear_private_data"), a);
    connect(a, SIGNAL(triggered(bool)), this, SLOT(clearPrivateData()));

    // ========================= History related actions ==============================
    a = actionCollection()->addAction(KStandardAction::Back);
    connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(openPrevious(Qt::MouseButtons, Qt::KeyboardModifiers)));

    m_historyBackMenu = new KMenu(this);
    a->setMenu(m_historyBackMenu);
    connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowBackMenu()));
    connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(openActionUrl(QAction *)));

    a = actionCollection()->addAction(KStandardAction::Forward);
    connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(openNext(Qt::MouseButtons, Qt::KeyboardModifiers)));

    // ============================== General Tab Actions ====================================
    a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this);
    a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_T));
    actionCollection()->addAction(QL1S("new_tab"), a);
    connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newTab()));

    a = new KAction(KIcon("view-refresh"), i18n("Reload All Tabs"), this);
    actionCollection()->addAction(QL1S("reload_all_tabs"), a);
    connect(a, SIGNAL(triggered(bool)), m_view, SLOT(reloadAllTabs()));

    a = new KAction(i18n("Show Next Tab"), this);
    a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext());
    actionCollection()->addAction(QL1S("show_next_tab"), a);
    connect(a, SIGNAL(triggered(bool)), m_view, SLOT(nextTab()));

    a = new KAction(i18n("Show Previous Tab"), this);
    a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev());
    actionCollection()->addAction(QL1S("show_prev_tab"), a);
    connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab()));

    a = new KAction(KIcon("tab-new"), i18n("Open Last Closed Tab"), this);
    a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_T));
    actionCollection()->addAction(QL1S("open_last_closed_tab"), a);
    connect(a, SIGNAL(triggered(bool)), m_view, SLOT(openLastClosedTab()));

    // Closed Tabs Menu
    KActionMenu *closedTabsMenu = new KActionMenu(KIcon("tab-new"), i18n("Closed Tabs"), this);
    closedTabsMenu->setDelayed(false);
    actionCollection()->addAction(QL1S("closed_tab_menu"), closedTabsMenu);

    // shortcuts for quickly switching to a tab
    for( int i = 1; i <= 9; i++ ) {
        a = new KAction(i18n("Switch to Tab %1", i), this);
        a->setShortcut(KShortcut( QString("Alt+%1").arg(i) ));
        a->setData( QVariant(i) );
        actionCollection()->addAction(QL1S(("switch_tab_" + QString::number(i)).toAscii()), a);
        connect(a, SIGNAL(triggered(bool)), m_view, SLOT(switchToTab()));
    }

    // ============================== Indexed Tab Actions ====================================
    a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this);
    a->setShortcuts( KStandardShortcut::close() );
    actionCollection()->addAction(QL1S("close_tab"), a);
    connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(closeTab()));

    a = new KAction(KIcon("tab-duplicate"), i18n("Clone Tab"), this);
    actionCollection()->addAction(QL1S("clone_tab"), a);
    connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(cloneTab()));

    a = new KAction(KIcon("tab-close-other"), i18n("Close &Other Tabs"), this);
    actionCollection()->addAction(QL1S("close_other_tabs"), a);
    connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(closeOtherTabs()));

    a = new KAction(KIcon("view-refresh"), i18n("Reload Tab"), this);
    actionCollection()->addAction(QL1S("reload_tab"), a);
    connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(reloadTab()));

    a = new KAction(KIcon("tab-detach"), i18n("Detach Tab"), this);
    actionCollection()->addAction(QL1S("detach_tab"), a);
    connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(detachTab()));

    // Bookmark Menu
    KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(this);
    bmMenu->setIcon(KIcon("bookmarks"));
    bmMenu->setDelayed(false);
    bmMenu->setShortcutConfigurable(true);
    bmMenu->setShortcut( KShortcut(Qt::ALT + Qt::Key_B) );
    actionCollection()->addAction(QL1S("bookmarksActionMenu"), bmMenu);

    // ---------------- Encodings -----------------------------------
    a = new KAction(KIcon("character-set"), i18n("Set Encoding"), this);
    actionCollection()->addAction(QL1S("encodings"), a);
    a->setMenu(m_encodingMenu);
    connect(m_encodingMenu, SIGNAL(aboutToShow()), this, SLOT(populateEncodingMenu()));
    connect(m_encodingMenu, SIGNAL(triggered(QAction *)), this, SLOT(setEncoding(QAction *)));
}
Пример #6
0
	void Document::RequestPrinting ()
	{
		emit printRequested (QList<int> ());
	}