Exemple #1
0
PMShell::PMShell( const KURL& url )
      : PMDockMainWindow( 0, "mainwindow" )
{
   setPluginLoadingMode( DoNotLoadPlugins );
   setInstance( PMFactory::instance( ), false );

   m_pPart = new PMPart( this, "part", this, "part", true, this );
   m_pPart->setReadWrite( ); // read-write mode
   m_viewNumber = 0;
   m_objectsToDelete.setAutoDelete( true );

   if (!initialGeometrySet())
      resize(800,600);

   setupActions( );

   restoreOptions( );

   setupView( );
   setXMLFile( "kpovmodelershell.rc" );
   createGUI( m_pPart );

   //guiFactory( )->addClient( m_pPart );
   m_pStatusBar = statusBar( );
   m_pStatusBar->insertItem( " ", c_statusBarInfo, 1 );
   m_pStatusBar->insertItem( "" , c_statusBarControlPoints );

   KConfig* config = instance( )->config( );
   config->setGroup( "Appearance" );
   applyMainWindowSettings( config );

   if( !url.isEmpty( ) )
      openURL( url );

   setCaption( url.prettyURL( ) );
   connect( m_pPart, SIGNAL( modified( ) ), SLOT( slotModified( ) ) );
   connect( m_pPart, SIGNAL( controlPointMessage( const QString& ) ),
            SLOT( slotControlPointMsg( const QString& ) ) );
}
//int main(int argc, char** argv) {
int myRTSPClient(char *pInfo, char *pURL) {
    // Begin by setting up our usage environment:
    TaskScheduler* scheduler = BasicTaskScheduler::createNew();
    UsageEnvironment* env = BasicUsageEnvironment::createNew(*scheduler);

    //openURL(*env, "TestRTSPClient.exe", "rtsp://mm2.pcslab.com/mm/7h800.mp4");
    openURL(*env, pInfo, pURL);

    // All subsequent activity takes place within the event loop:
    env->taskScheduler().doEventLoop(&eventLoopWatchVariable);
    // This function call does not return, unless, at some point in time, "eventLoopWatchVariable" gets set to something non-zero.

    return 0;

    // If you choose to continue the application past this point (i.e., if you comment out the "return 0;" statement above),
    // and if you don't intend to do anything more with the "TaskScheduler" and "UsageEnvironment" objects,
    // then you can also reclaim the (small) memory used by these objects by uncommenting the following code:
    /*
     env->reclaim(); env = NULL;
     delete scheduler; scheduler = NULL;
     */
}
void CRTSPSession::rtsp_fun()
{
    //::startRTSP(m_progName.c_str(), m_rtspUrl.c_str(), m_ndebugLever);
    TaskScheduler* scheduler = BasicTaskScheduler::createNew();
    UsageEnvironment* env = BasicUsageEnvironment::createNew(*scheduler);
    if (openURL(*env, m_progName.c_str(), m_rtspUrl.c_str(), m_debugLevel) == 0) {
        m_nStatus = 1;
        env->taskScheduler().doEventLoop(&eventLoopWatchVariable);

        m_running = false;
        eventLoopWatchVariable = 0;

        if (m_rtspClient)  {
            shutdownStream(m_rtspClient,0);
        }
        m_rtspClient = NULL;
    }

    env->reclaim(); 
    env = NULL;
    delete scheduler; 
    scheduler = NULL;
    m_nStatus = 2;
}
Exemple #4
0
void KFMExec::slotMimeType( const char *_type )
{
    // A dirty hack for passing the character set
    char *typestr=0;
    const char *aType=0;
    const char *aCharset=0;
    if ( _type )
    {
        typestr=new char[strlen(_type)+1];
        strcpy(typestr,_type);
	aType=strtok(typestr," ;\t\n");
	char *tmp;
	while((tmp=strtok(0," ;\t\n"))){
            if ( strncmp(tmp,"charset=",8)==0 ) aCharset=tmp+8;
	}    
	if ( aCharset != 0 )
	{
	    tmp=strpbrk((char*)aCharset," ;\t\n");
	    if ( tmp != 0 ) *tmp=0;
	}    
    }  
    
    // Stop browsing. We need an application
    job->stop();
    // delete job;
    // job = 0L;
    
    // GZIP
    if ( aType && strcmp( aType, "application/x-gzip" ) == 0L )
    {
	job->stop();
	tryURL += "#gzip:/";
	openURL( tryURL );
    }
    // TAR
    else if ( aType && strcmp( aType, "application/x-tar" ) == 0L )
    {
	// Is this tar file perhaps hosted in a gzipped file ?
	KURL u( tryURL );
	// ... then we already have a 'gzip' subprotocol
	if ( u.hasSubProtocol() )
	{
	    KURL u2( u.nestedURL() );
	    if ( strcmp( u2.protocol(), "gzip" ) == 0 )
	    {
		// Remove the 'gzip' protocol. It will only slow down the process,
		// since two subprotocols '#gzip:/#tar:/' are not very fast
		// right now.
		tryURL = u.parentURL();
	    }
	}
	
	job->stop();
	tryURL += "#tar:/";
	openURL( tryURL );
    }
    // No HTML ?
    else if ( aType == 0L || strcmp( aType, "text/html" ) != 0L )
    {
      bool bdone = false;
      // Do we know the mime type ?
      if ( aType != 0L )
      {
	KMimeType *mime = KMimeType::findByName( aType );
	// Try to run the URL if we know the mime type
	if ( mime && mime->run( tryURL ) )
	{
	  // We are a zombie now
	  prepareToDie();
	  bdone = true;
	}
      }
		
      if ( !bdone )
      {    
	// Ask the user what we should do
	OpenWithDlg l( klocale->translate("Open With:"), "", 0L, true );
	if ( l.exec() )
	{
	  KMimeBind *bind = l.mimeBind();
	  if ( bind )
	  {
	    bind->runBinding( tryURL );
	  }
	  else
	  {
	    QString pattern = l.getText();
	    // The user did not something ?
	    if ( !pattern.isEmpty() )
	    {
	      QStrList list;
	      list.append( tryURL );
	      openWithOldApplication( pattern, list );
	    }

	    // We are a zombie now
	    prepareToDie();
	  }	
	}
      }
    }
    // It is HTML
    else
    {
	// Ok, lets open a new window
	KfmGui *m = new KfmGui( 0L, 0L, tryURL );
	if ( aCharset != 0 ) m->setCharset(aCharset);
	if ( dlg )
	  {
	    delete dlg;
	    dlg = 0L;
	  }
	m->show();
	
	// We are a zombie now
	prepareToDie();
    }
    delete typestr;
}
Exemple #5
0
void w_main::on_actionTranslate_the_mod_help_triggered()
{
    openURL("http://forums.civfanatics.com/showthread.php?t=526671");
}
Exemple #6
0
void w_main::on_actionHelp_translate_the_mod_triggered()
{
    openURL("https://www.transifex.com/projects/p/and-main-mod/");
}
Exemple #7
0
void w_main::on_actionAbout_AND_Resurrection_team_forum_triggered()
{
    openURL("http://anewdawn.sf.net/pages/credits/");
}
Exemple #8
0
void w_main::on_actionWebsite_triggered()
{
    openURL("http://anewdawn.sf.net");
}
Exemple #9
0
// ---------------------------------
void USys::callLocalURL(const char *str, int port) {
    char cmd[512];
    sprintf(cmd, "http://localhost:%d/%s", port, str);
    openURL(cmd);
}
Exemple #10
0
void
URLLabel::openURL()
{
    openURL( d->URL );
}
Exemple #11
0
/*
 *	return true, if have something needed to send
 *	you need to delete readbuffer if not use anymore;
 */
void MmsServer::JsonProcess(int fd, fastbuffer * readbuffer, YYLibMysql * mysql)
{
	if (fd <= 0 || !readbuffer)
		return;

	fastbuffer * buf = NULL;
	Item_data_ptr state = get_state(fd);
	if (state)
	{
		if (state->readbuffer)
		{
			state->readbuffer->append(readbuffer->buf(), readbuffer->size());
		}
		else
		{
			state->readbuffer = readbuffer;
			readbuffer = NULL;
		}
		buf = state->readbuffer;
	}
	else
	{
		buf = readbuffer;
	}

	// json process
	YYJ * jobj;
	do 
	{
		int offset = 0;
		jobj = NULL;
		YYMMSJSON_ERROR err;
		err = YYmmsJson::ParseCmd(buf->buf(), buf->size(), offset, jobj);
		switch (err)
		{
		case YYMMSJSON_ERROR_SUCCESS:
			{
				if (jobj->_id == YY_JSON_LOGIN)
				{	// check user account
					YYJson_Login * login = (YYJson_Login*)jobj;
					if (!state)
					{
						state = boost::shared_ptr<Item_data>(new Item_data);
						if (!state) break;
						state->fd = fd;
						state->readbuffer = readbuffer;
						readbuffer = NULL;
						add_state(fd, state);
						_userData.add_state(login->yyID, state);
					}
					state->yyID = login->yyID;
					state->token = login->token;
					state->rsaStr = login->rsakey;
					std::string prik;
					state->rsa.SetRSAKey(state->rsaStr, prik);
					state->loginTime = GetTickCount();
					LoginCmd(fd, state, mysql);
				}
				else
				{
					if (!state)
					{
						LOG::Info("YY_JSON_LOGIN not login fd=%d", fd);
						break;
					}
NextRun:
					switch (jobj->_id)
					{
					case YY_JSON_COMPRESS_RSA:
						{
							assert(false);
						}
						break;
					case YY_JSON_COMPRESS_AES:
						{
							YYJson_Comp_AES * cmd = (YYJson_Comp_AES*)jobj;
							YYJ * realobj;
							if (!cmd->UnFormat(state->aes, realobj))
								break;

							YYmmsJson::FreeCmd(jobj);
							jobj = realobj;
							goto NextRun;
						}
						break;
					case YY_JSON_LOGIN1:
						{
							YYJson_Login1 * cmd = (YYJson_Login1*)jobj;
							state->uid = cmd->uid;
							state->account = cmd->user;
							state->pwd = cmd->pwd;

							YYJson_Login1_res resp;
							resp.bSucc = true;
							_sendCmd(fd, &resp);
						}
						break;
					case YY_JSON_LOGOUT:
						{
							LOG::Info("YY_JSON_LOGIN logout fd=%d, uid=%u, account:%s, logintime=%u, logouttime=%u", fd, state->uid, state->account.c_str(), state->loginTime, GetTickCount());
							YYJson_Logout_res resp;
							resp.yyID = state->yyID;
							_sendCmd(fd, &resp);

							ShellExit(state);

							_userData.del_state(state->yyID);
							del_state(fd);
						}
						break;
					case YY_JSON_OPENURL:
						{
							YYJson_OpenUrl * cmd = (YYJson_OpenUrl*)jobj;
							state->channelID = cmd->channelID;
							state->subChannelID = cmd->subChannelID;
							state->url = cmd->url;

							bool bSucc = true;
							if (state->isConnectShellClient())
								openURL(state->shellClient_fd, state);
							else
							{
								bSucc = ShellExec(state);
							}
							YYJson_OpenUrl_res resp;
							resp.bSucc = (json_bool)bSucc;
							_sendCmd(fd, &resp);
						}
						break;
					}
					// LOG::Info("json %s", json_object_to_json_string(jobj->_jobj));
				}
				buf->read(NULL, offset);
				YYmmsJson::FreeCmd(jobj);
			}
			break;
		// case YYMMSJSON_ERROR_ESC:
		// case YYMMSJSON_ERROR_JSON:
		default:
			buf->clear();
			_event.closefd(fd);
			break;
		}
	} while (buf->size() > 0);
	
	if (readbuffer)
		delete readbuffer;
}
Exemple #12
0
void TDEAboutContributor::urlClickedSlot( const TQString &u )
{
  emit openURL(u);
}
Exemple #13
0
void PluginPart::changeSrc(const QString &url)
{
    closeURL();
    openURL(KURL(url));
}
Exemple #14
0
void KFMExec::openURL( const char *_url  )
{
    KURL u( _url );
    if ( u.isMalformed() )
    {
	QString tmp;
	tmp << klocale->translate("Malformed URL\n") << _url;
	QMessageBox::warning( 0, klocale->translate("KFM Error"), tmp );
	// We are a zombie now
	prepareToDie();
	return;
    }

    // --- start do mailto kdelnks ----
    // Pasted from kfmman.cpp - almost verbatim
    // This way kfm can open mailto kdelnks from desktop and other
    // places too - nothing can stop us now to have address book
    // done like bookmarks :-) (sven)
    // Dirty hack for calling kmail
    if ( strcmp( u.protocol(), "mailto" ) == 0 )
    {
	QString subject;
	QString to( u.path() );
	int i;
	if ( ( i = to.find( '?' ) ) != -1 )
	    to = to.left( i ).data();
	QString cmd;
	cmd << "kmail -s \"" << subject << "\" \"" << to << "\"";
	KMimeBind::runCmd( cmd );
	return;
    }
    // --- end do mailto kdelnks ----
    
    // A link to the web in form of a *.kdelnk file ?
    QString path = u.path();
    if ( !u.hasSubProtocol() && strcmp( u.protocol(), "file" ) == 0 && path.right(7) == ".kdelnk" )
    {
	// Try tp open the *.kdelnk file
	QFile file( path );
	if ( file.open( IO_ReadOnly ) )
	{
	    file.close();
	    KConfig config( path );
	    config.setGroup( "KDE Desktop Entry" );
	    QString typ = config.readEntry( "Type" );
	    // Is it a link ?
	    if ( typ == "Link" )
	    {
		// Is there a URL ?
		QString u2 = config.readEntry( "URL" );
		if ( !u2.isEmpty() )
		{
		    // It is a link and we have new URL => Recursion with the new URL
		    openURL( u2 );
		    return;
		}
		else
		{
		    // The *.kdelnk file is broken
		    QMessageBox::warning( 0, klocale->translate("KFM Error"), 
					  klocale->translate("The file does not contain a URL") );
		    // We are a zombie now
		    prepareToDie();
		    return;
		}
	    }
	    file.close();
	}
    }
    
    // Do we know that it is !really! a file ?
    // This gives us some speedup on local hard disks.
    if ( KIOServer::isDir( _url ) == 0 && !u.hasSubProtocol() && strcmp( u.protocol(), "file" ) == 0 )
    {    
	tryURL = openLocalURL( _url );
	if ( tryURL.isEmpty() )
	    return;
    }
    // Do we really know that it is a directory ?
    else if ( KIOServer::isDir( _url ) == 1 )
    {
	// Ok, lets open a new window
	KfmGui *m = new KfmGui( 0L, 0L, _url );
	if ( dlg )
	  {
	    delete dlg;
	    dlg = 0L;
	  }
	m->show();
	return;
    }
    // We are not shure about the URL
    else
	// We try to load this URL now
	tryURL = _url;
    
    // Show the user that we are doing something, since it may take
    // us some time.
    dlg = new QDialog( 0L );
    // make sure window doesn't initially have the focus
    KWM::setDecoration(dlg->winId(), KWM::normalDecoration | KWM::noFocus);
    dlg->resize( 300, 120 );
    QPushButton *pb = new QPushButton( klocale->translate("Cancel"), dlg );
    pb->setGeometry( 110, 70, 80, 30 );
    pb->setDefault(TRUE);
    connect( pb, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );
    QLabel* line1 = new QLabel( dlg );
    line1->setGeometry( 10, 10, 280, 20 );
    line1->setText( klocale->translate("Trying to open") );
    QLabel* line2 = new QLabel( dlg );
    line2->setGeometry( 10, 30, 280, 20 );
    KURL displayedURL (tryURL); 
    displayedURL.setPassword(""); // hide password
    line2->setText( displayedURL.url() );
    
    dlg->show();

    // Find out what to do with this URL.
    job->browse( tryURL, false );
}
Exemple #15
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();
}
//------------------------------------------------------------------------------
// Name: doCompose
// Desc:
//------------------------------------------------------------------------------
void QGmailNotifier::doCompose() {
	openURL("http://mail.google.com/mail/#compose");
}
/*!
	Open a help URL
	
	\param url the URL to open
	
	This method opens a help page designated by URL. By default it does
	the same as opening and URL, ie likely to be in the web browser.
	Override it to open this in a different viewer like Help Viewer (MacOS X),
	gnome-help (GNOME), etc.
	It should check the protcol (file: vs http:)
 */
bool XAP_AppImpl::openHelpURL(const char * url)
{
	return openURL(url);
}
Exemple #18
0
void KSysinfoPart::rescan()
{
    openURL( "sysinfo:/" );
    rescanTimer->stop();
    rescanTimer->start( 20000, true );
}
Exemple #19
0
void PMShell::slotOpenRecentTimer( )
{
   openURL( m_openRecentURL );
}
Exemple #20
0
// ---------------------------------
void USys::getURL(const char *url) {
    if (strnicmp(url, "http://", 7) || strnicmp(url, "mailto:", 7)) {
        openURL(url);
    }
}
void alterobooksView::openURL(QString url)
{
    openURL(KURL(url));
}
Exemple #22
0
void w_main::on_actionBugreport_triggered()
{
    openURL("http://forums.civfanatics.com/showthread.php?t=474185");
}
Exemple #23
0
void KFileTreeBranch::slCompleted( const KURL& url )
{
    kdDebug(250) << "SlotCompleted hit for " << url.prettyURL() << endl;
    KFileTreeViewItem *currParent = findTVIByURL( url );
    if( ! currParent ) return;

    kdDebug(250) << "current parent " << currParent << " is already listed: "
                 << currParent->alreadyListed() << endl;

    emit( populateFinished(currParent));
    emit( directoryChildCount(currParent, currParent->childCount()));

    /* This is a walk through the children of the last populated directory.
     * Here we start the dirlister on every child of the dir and wait for its
     * finish. When it has finished, we go to the next child.
     * This must be done for non local file systems in dirOnly- and Full-Mode
     * and for local file systems only in full mode, because the stat trick
     * (see addItem-Method) does only work for dirs, not for files in the directory.
     */
    /* Set bit that the parent dir was listed completely */
    currParent->setListed(true);

    kdDebug(250) << "recurseChildren: " << m_recurseChildren << endl;
    kdDebug(250) << "isLocalFile: " << m_startURL.isLocalFile() << endl;
    kdDebug(250) << "dirOnlyMode: " << dirOnlyMode() << endl;


    if( m_recurseChildren && (!m_startURL.isLocalFile() || ! dirOnlyMode()) )
    {
        bool wantRecurseUrl = false;
        /* look if the url is in the list for url to recurse */
        for ( KURL::List::Iterator it = m_openChildrenURLs.begin();
              it != m_openChildrenURLs.end(); ++it )
        {
            /* it is only interesting that the url _is_in_ the list. */
            if( (*it).equals( url, true ) )
                wantRecurseUrl = true;
        }

        KFileTreeViewItem    *nextChild = 0;
        kdDebug(250) << "Recursing " << url.prettyURL() << "? " << wantRecurseUrl << endl;

        if( wantRecurseUrl && currParent )
        {

            /* now walk again through the tree and populate the children to get +-signs */
            /* This is the starting point. The visible folder has finished,
               processing the children has not yet started */
            nextChild = static_cast<KFileTreeViewItem*>
                        (static_cast<TQListViewItem*>(currParent)->firstChild());

            if( ! nextChild )
            {
                /* This happens if there is no child at all */
                kdDebug( 250 ) << "No children to recuse" << endl;
            }

            /* Since we have listed the children to recurse, we can remove the entry
             * in the list of the URLs to see the children.
             */
            m_openChildrenURLs.remove(url);
        }

        if( nextChild ) /* This implies that idx > -1 */
        {
            /* Next child is defined. We start a dirlister job on every child item
             * which is a directory to find out how much children are in the child
             * of the last opened dir
             */

            /* Skip non directory entries */
            while( nextChild )
            {
                if( nextChild->isDir() && ! nextChild->alreadyListed())
                {
                    KFileItem *kfi = nextChild->fileItem();
                    if( kfi && kfi->isReadable())
                    {
                        KURL recurseUrl = kfi->url();
                        kdDebug(250) << "Starting to recurse NOW " << recurseUrl.prettyURL() << endl;
                        openURL( recurseUrl, true );
                    }
                }
                nextChild = static_cast<KFileTreeViewItem*>(static_cast<TQListViewItem*>(nextChild->nextSibling()));
                // kdDebug(250) << "Next child " << m_nextChild << endl;
            }
        }
    }
    else
    {
        kdDebug(250) << "skipping to recurse in complete-slot" << endl;
    }
}
Exemple #24
0
void w_main::on_actionGive_us_feedback_forum_triggered()
{
    openURL("http://forums.civfanatics.com/forumdisplay.php?f=369");
}
Exemple #25
0
HexWidget::HexWidget(const char* file) {
    initMenu();
    openURL(file,READWRITE);
}
Exemple #26
0
void w_main::on_actionTranslate_the_civilopedia_triggered()
{
    openURL("https://www.transifex.com/projects/p/and-civilopedia-strings/");
}
void ksimoptsView::openURL(QString url)
{
    openURL(KURL(url));
}
Exemple #28
0
void w_main::on_bt_launch_clicked()
// GUI : Launch game button
{
    // Check if the game path is known

    if(readCheckerParam("Main/ExecutablePath") == "error") {
        QMessageBox::information(0, "Information", tr("To be able to launch the game from the launcher, you need to set the game path in the options window. (Options > Select game path)"));
        return;
    }
    else {
        QString lang = getCurrentLanguage();
        QString executable;
        if(lang == "ko" || lang == "ja" || lang == "zh")
        { // Asian language have a different executable, supporting 2-bytes encoding
            executable = readCheckerParam("Main/ExecutablePath");
            QString asian_executable = executable;
            asian_executable.replace("Civ4BeyondSword.exe","Civ4BeyondSword_Asian.exe");
            QFile exe(executable);
            if(!exe.exists())
            {
                QMessageBox::information(0, "Information", tr("The executable hasn't been found. Please set the game path in the options window. (Options > Select game path)"));
                return;
            }
            QFile asian_exe(asian_executable);
            if(!asian_exe.exists())
            { // Make a question box
                QMessageBox question;
                question.setWindowTitle(tr("Asian language patch not applied"));
                question.setText(tr("You need to apply a patch on the base game for the extension to be compatible with Asian languages. The original version won't be modified. Would you like to apply it now ?"));
                question.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
                int ret = question.exec();
                switch(ret){
                    case QMessageBox::Ok:
                        system("checker\\asian_patcher.exe");
                        return;
                        break;

                    case QMessageBox::Cancel:
                        return;
                        break;

                    default:
                        return;
                        break;
                }
            }
            launchGame(asian_executable);
        }
        else
        {
            executable = readCheckerParam("Main/ExecutablePath");
            QFile exe(executable);
            if(!exe.exists())
            {
                QMessageBox::information(0, "Information", tr("The executable hasn't been found. Please set the game path in the options window. (Options > Select game path)"));
                return;
            }
            //qDebug() << "Executable checksum is " << checkMd5(executable);
            // Warn when the latest Steam version is used
            if(checkMd5(executable) == "93a64f40d3d4093faeac3e9e626f79de" && readCheckerParam("Main/DisableWarning") != "1")
            {
                QMessageBox::information(0, "Information", tr("The game version you are using is known for causing some display problems, like invisible religion icons. Please read the 'note for Steam users' on our website to fix the problem. The website help page will now open.")+ "\n\n" + tr("You can disable this warning in the options."));
                openURL("http://anewdawn.sourceforge.net/pages/install/");
                return;
            }
            launchGame(executable);
        }

    }

    // Check if the launcher should quit

    if(readCheckerParam("Main/QuitLauncher") == "1") {
        qApp->exit();
    }
    else {
        this->setWindowState(Qt::WindowMinimized);
    }
}
Exemple #29
0
void kgitView::openURL(QString url)
{
  openURL(KURL(url));
}