void KSlovar::registerButtons() { m_newDictionary = new KAction(i18n("&New dictionary"), "filenew", KShortcut(KKey("CTRL+n")), this, SLOT(slotNewDictionary()), actionCollection(), "newDictionary"); m_openDictionary = KStdAction::open(this, SLOT(slotFileOpen()), actionCollection()); m_quit = KStdAction::quit(kapp, SLOT(quit()), actionCollection()); m_back=KStdAction::back(this, SLOT(slotPrevPhrase()), actionCollection()); m_forward=KStdAction::forward(this, SLOT(slotNextPhrase()), actionCollection()); m_home=KStdAction::home(this, SLOT(slotHome()), actionCollection()); m_editDictionary = new KAction(i18n("&Edit dictionary"), "edit", KShortcut(KKey("CTRL+e")), this, SLOT(slotEditDictionary()), actionCollection(), "editDictionary"); m_close=KStdAction::close(this, SLOT(slotClose()), actionCollection()); m_find = KStdAction::find(this, SLOT(slotFind()), actionCollection()); m_findNext = KStdAction::findNext(this, SLOT(slotFindNext()), actionCollection()); m_literalSearch = new KToggleAction(i18n("&Literal search"), "filter", KShortcut(KKey("CTRL+l")), this, SLOT(slotToggleLiteral()), actionCollection(), "literalSearch"); m_backSearch = new KToggleAction(i18n("Ba&ck search"), "previous", KShortcut(KKey("CTRL+b")), this, SLOT(slotToggleBack()), actionCollection(), "backSearch"); m_print=KStdAction::print(this, SLOT(slotPrint()), actionCollection()); m_selectAll=KStdAction::selectAll(this, SLOT(slotSelectAll()), actionCollection()); m_addPhrase=new KAction(i18n("&Add phrase"), "filenew", KShortcut(KKey("CTRL+a")), this, SLOT(slotAddPhrase()), actionCollection(), "addPhrase"); m_editPhrase=new KAction(i18n("Edi&t phrase"), "edit", KShortcut(KKey("CTRL+t")), this, SLOT(slotEditPhrase()), actionCollection(), "editPhrase"); m_removePhrase=new KAction(i18n("&Remove phrase"), "editdelete", KShortcut(KKey("Delete")), this, SLOT(slotRemovePhrase()), actionCollection(), "removePhrase"); m_listPopup=new QPopupMenu; m_addPhrase->plug(m_listPopup); m_editPhrase->plug(m_listPopup); m_removePhrase->plug(m_listPopup); m_config = KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection()); m_conversion = new KAction(i18n("Edit &conversion table"), "conversion", this, SLOT(slotConversionTable()), actionCollection(), "editConversion"); m_update = new KAction(i18n("Update &languages"), "ktalkd", KShortcut(KKey("")), this, SLOT(slotDownloadLanguage()), actionCollection(), "updateLanguages"); m_wizard = new KAction(i18n("Run &First-time wizard"), "wizard", KShortcut(KKey("")), this, SLOT(slotFirstRunWizard()), actionCollection(), "firstRunWizard"); }
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; }
dlgTextBrowser::dlgTextBrowser(const char *manual) { char cmd[1024],buf[1024]; homeIsSet = 0; strcpy(buf,"index.html"); form = new Ui_DialogTextBrowser; form->setupUi(this); #ifndef USE_ANDROID form->textBrowser->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true); #endif if(manual == NULL) { setWindowTitle(tr("pvbrowser Manual")); } else { if(strlen(manual) < (int) (sizeof(cmd)-1) ) strcpy(buf,manual); } #ifdef PVWIN32 ExpandEnvironmentStringsA(buf,cmd,sizeof(cmd)-1); #else strcpy(cmd,buf); #endif QFile fin(cmd); if(fin.exists()) { // this is damn slow on windows begin #ifdef PVDEVELOP QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); #ifdef USE_ANDROID form->textBrowser->setSource(QUrl::fromLocalFile(cmd)); #else form->textBrowser->load(QUrl::fromLocalFile(cmd)); #endif QApplication::restoreOverrideCursor(); #endif // this is damn slow on windows end home = cmd; homeIsSet = 1; } else { form->textBrowser->setHtml("<html><head></head><body>Sorry no application specific help specified.</body></html>"); } QObject::connect(form->pushButtonFind,SIGNAL(clicked()),this,SLOT(slotFind())); QObject::connect(form->lineEditPattern,SIGNAL(returnPressed()),this,SLOT(slotFind())); QObject::connect(form->pushButtonClose,SIGNAL(clicked()),this,SLOT(hide())); QObject::connect(form->pushButtonHome,SIGNAL(clicked()),this,SLOT(slotHome())); QObject::connect(form->pushButtonBack,SIGNAL(clicked()),this,SLOT(slotBack())); find = 0; }
void KSlovar::processFileOpen(const QString &fileName) { QStringList temp; if( !fileName.isEmpty() ) { QFile file( fileName ); if( file.open(IO_ReadOnly) ) { QString temp; file.readLine(temp, 50); if( !temp.startsWith("SQLite format 3") ) { KMessageBox::error(this, i18n("This is not a valid dictionary!") ); return; } slotClose(); } else { KMessageBox::error(this, i18n("Couldn't read the dictionary!") ); return; } file.close(); KSData::instance()->setDictionary(new KSDBHandler(fileName)); KSData::instance()->getDictionary()->start(); m_home->setEnabled(true); m_editDictionary->setEnabled(true); m_close->setEnabled(true); m_addPhrase->setEnabled(true); m_backHistory.clear(); KSData::instance()->setDictionaryPath(fileName); loadPartOfSpeech(KSData::instance()->getDictionary()->processString("SELECT lang FROM head;").toInt()); int type = KSData::instance()->getDictionary()->processString("SELECT type FROM head;").toInt(); KSData::instance()->setType(type); if(!type) { XMLParser=new KSXSLHandler(QString::fromUtf8(locate("appdata", "styles/"+Configuration::dictionaryStyle()+"/"+Configuration::dictionaryStyle()+"-default.xsl"))); } else { XMLParser=new KSXSLHandler(QString::fromUtf8(locate("appdata", "styles/"+Configuration::dictionaryStyle()+"/"+Configuration::dictionaryStyle()+"-transitional.xsl"))); } m_search->setDisabled(false); m_list->setEmptyText(i18n("Begin search by typing a\nword into the search bar.")); m_list->clear(); slotHome(); } }
dlgMyBrowser::dlgMyBrowser(int *sock, int ident, QWidget *parent, const char *manual) { if(opt.arg_debug) printf("dlgMyBrowser:dlgMyBrowser()\n"); s = sock; id = ident; mainWindow = (MainWindow *) parent; form = new Ui_MyBrowser; form->setupUi(this); #ifdef USE_WEBKIT QObject::connect(form->pushButtonBack,SIGNAL(clicked()) ,this, SLOT(slotBack())); QObject::connect(form->pushButtonHome,SIGNAL(clicked()) ,this, SLOT(slotHome())); QObject::connect(form->pushButtonForward,SIGNAL(clicked()) ,this, SLOT(slotForward())); QObject::connect(form->pushButtonReload,SIGNAL(clicked()) ,this, SLOT(slotReload())); QObject::connect(form->pushButtonFind,SIGNAL(clicked()) ,this, SLOT(slotFind())); QObject::connect(form->lineEditPattern,SIGNAL(returnPressed()) ,this, SLOT(slotFind())); QObject::connect(form->browser,SIGNAL(urlChanged(const QUrl &)) ,this, SLOT(slotUrlChanged(const QUrl &))); QObject::connect(form->browser,SIGNAL(linkClicked(const QUrl &)) ,this, SLOT(slotLinkClicked(const QUrl &))); QObject::connect(form->browser,SIGNAL(titleChanged(const QString &)) ,this, SLOT(slotTitleChanged(const QString &))); QObject::connect(form->browser,SIGNAL(loadFinished(bool)) ,this, SLOT(slotLoadFinished(bool))); //QWebPage *page = form->browser->page(); //QObject::connect(page,SIGNAL(unsupportedContent(QNetworkReply *)),this, SLOT(slotUnsupportedContent(QNetworkReply *))); //enabling plugins leads to problems //see: https://bugs.webkit.org/show_bug.cgi?id=56552 that we have reported if(opt.enable_webkit_plugins) { if(opt.arg_debug) printf("enable_webkit_plugins\n"); form->browser->settings()->setAttribute(QWebSettings::PluginsEnabled, true); form->browser->settings()->setAttribute(QWebSettings::JavascriptEnabled, true); } else { if(opt.arg_debug) printf("do not enable_webkit_plugins\n"); form->browser->settings()->setAttribute(QWebSettings::PluginsEnabled, false); form->browser->settings()->setAttribute(QWebSettings::JavascriptEnabled, false); } #endif if(manual == NULL) return; }