示例#1
0
KCModuleProxyRootCommunicatorImpl::KCModuleProxyRootCommunicatorImpl(const QCString &name, KCModuleProxy *const client)
    : DCOPObject(name), QObject(0, name), p(const_cast< KCModuleProxy * >(client))
{
    /*
     * Connect kcmshell's KCModuleProxy's change signal
     * to us, such that we act as a proxy for
     * KCModuleProxy's API.
     */

    /* Note, we don't use KCModuleProxy::d->dcopClient */
    kapp->dcopClient()->connectDCOPSignal(0, p->dcopName(), "changed(bool)", objId(), "changed(bool)", false);

    kapp->dcopClient()->connectDCOPSignal(0, p->dcopName(), "quickHelpChanged()", objId(), "quickHelpChanged()", false);
}
示例#2
0
文件: knazar.cpp 项目: Tayyib/uludag
knazar::knazar()
    : DCOPObject( "DCOPNazarIface" ), KSystemTray( 0, "knazar" )
{
	// Insert TrayIcon
	trayIcon = KSystemTray::loadIcon( "knazar" );
	setPixmap( trayIcon );

	// Initialize and Register KNazar DCOP Interface so any KDE program can make Nazar easily
	if ( !kapp->dcopClient()->isRegistered() )
	{
		kapp->dcopClient()->registerAs( "knazar" );
		kapp->dcopClient()->setDefaultObject( objId() );
	}


	// Build PopupMenu
	KPopupMenu* menu = contextMenu();

	( new KAction( i18n( "Protect" ), "ledgreen", 0, this, SLOT( protect_from_harmfull_looks() ), this ) )->plug( menu );
	( new KAction( i18n( "Release" ), "ledred", 0, this, SLOT( release_the_protection() ), this ) )->plug( menu );
	menu->insertSeparator();
	( new KAction( i18n( "About" ), "about", 0, this, SLOT( about() ), this ) )->plug( menu );

	// Initialize variables
	protection_working = true;
	number_of_attacks = defated_attacks = 0;
	QToolTip::add( this, i18n( "knazar - No Harmfull look allowed!" ));
}
示例#3
0
文件: dcop.cpp 项目: debrouxl/tiemu
TiEmuDCOP::TiEmuDCOP() : DCOPObject( "TiEmuDCOP" )
{
  // Register with DCOP
  if (!kapp->dcopClient()->isRegistered()) 
    kapp->dcopClient()->attach();
  kapp->dcopClient()->setDefaultObject(objId());
}
示例#4
0
bool KWMailMergeDataBase::askUserForConfirmationAndConfig(KWMailMergeDataSource *tmpPlugin,bool config,QWidget *par,int version)
{
    if (tmpPlugin)
    {
        bool replaceit=false;
        if (!config) replaceit=true;
        else
            replaceit=tmpPlugin->showConfigDialog(par,action);
        if (replaceit)
        {
            if (plugin)
            {
                if (KMessageBox::warningContinueCancel(par,
                            i18n("Do you really want to replace the current datasource?"),
                            QString::null,QString::null,QString::null,true)== KMessageBox::Cancel)
                {
                    delete tmpPlugin;
                    tmpPlugin=0;
                    return false;
                }
                delete plugin;
            }
            m_version=version;
            plugin=tmpPlugin;
        }
        else
        {
            delete tmpPlugin;
            tmpPlugin=0;
            return false;
        }
    }
    tmpPlugin->setObjId(QCString(objId()+".MailMergePlugin"));
    return true;
}
 DcopCollectionScannerHandler::DcopCollectionScannerHandler()
     : DCOPObject( "scanner" )
     , QObject( kapp )
 {
     // Register with DCOP
     if ( !kapp->dcopClient()->isRegistered() ) {
         kapp->dcopClient()->registerAs( "panacollectionscanner", false );
         kapp->dcopClient()->setDefaultObject( objId() );
     }
 }
示例#6
0
 DcopPlayerHandler::DcopPlayerHandler()
     : DCOPObject( "player" )
     , QObject( kapp )
 {
     // Register with DCOP
     if ( !kapp->dcopClient()->isRegistered() ) {
         kapp->dcopClient()->registerAs( "amarok", false );
         kapp->dcopClient()->setDefaultObject( objId() );
     }
 }
示例#7
0
QCString KickerClientMenu::insertMenu(QPixmap icon, QString text, int id)
{
    QString subname("%1-submenu%2");
    QCString subid = subname.arg(objId()).arg(id).local8Bit();
    KickerClientMenu *sub = new KickerClientMenu(this, subid);
    int globalid = QPopupMenu::insertItem(icon, text, sub, id);
    setItemParameter(globalid, id);

    return subid;
}
示例#8
0
void
printNextObjChain(void *obj)
{
    Obj *p = OBJ(obj);

    if (p == 0)
	return;
    do {
	assert(p != 0);
	printf("(%d,%d) %s title [%s]\n", p->x, p->y, objId(p), objTitle(p));
	p = p->next;
    } while (p != OBJ(obj));
} /* printNextObjChain */
dcoper::dcoper(QWidget *parent, const char *name ) : QWidget(parent,name), DCOPObject( "dcoper" ) {

  QCString  appIdef;
  padre=(mainWin *)parent->parent();
 if ( !kapp->dcopClient()->isRegistered() ) {
          kapp->dcopClient()->registerAs( "dcoper" );
          kapp->dcopClient()->setDefaultObject( objId() );
 }
  appIdef=kapp->dcopClient()->appId();

  downloadFinished=true;
  status=0;
  errstatus=0;
  printf("%s\n",appIdef.data());
}
示例#10
0
void BoxContainerItem::showPassivePopup(QWidget *parent, QPtrList< KornMailSubject > *list, int total,
                                        const QString &accountName, bool date)
{
    KPassivePopup *popup = new KPassivePopup(parent, "Passive popup");

    QVBox *mainvlayout = popup->standardView(i18n("KOrn - %1/%2 (total: %3)").arg(objId()).arg(accountName)
                         .arg(total), "", QPixmap(), 0);
    QGrid *mainglayout = new QGrid(date ? 3 : 2 , mainvlayout, "Grid-Layout");

    QLabel *title = new QLabel(i18n("From"), mainglayout, "from_label");
    QFont font = title->font();
    font.setBold(true);
    title->setFont(font);

    title = new QLabel(i18n("Subject"), mainglayout, "subject_label");
    font = title->font();
    font.setBold(true);
    title->setFont(font);

    if(date)
    {
        title = new QLabel(i18n("Date"), mainglayout, "date_label");
        font = title->font();
        font.setBold(true);
        title->setFont(font);
    }

    for(KornMailSubject *subject = list->first(); subject; subject = list->next())
    {
        new QLabel(subject->getSender(), mainglayout, "from-value");
        new QLabel(subject->getSubject(), mainglayout, "subject-value");
        if(date)
        {
            QDateTime tijd;
            tijd.setTime_t(subject->getDate());
            new QLabel(tijd.toString(), mainglayout, "date-value");
        }
    }

    popup->setAutoDelete(true);   //Now, now care for deleting these pointers.

    popup->setView(mainvlayout);

    popup->show(); //Display it
}
示例#11
0
/**
 * Add records to first shard for a single Kind
 */
MojErr MojDbShardManagerTest::createShardObjects1 (MojDb& db, MojDbShardInfo& shard)
{
    MojObject objKind;
    MojString kindId;

    MojErr err = kindId.assign(_T("TestShard1:1"));
    MojErrCheck(err);
    err = objKind.putString(_T("_kind"), kindId.data());
    MojErrCheck(err);

    //generate
    err = generateItem(shard);
    MojErrCheck(err);

    err = addKind(TestShardKind1Str, db);
    MojErrCheck(err);
    err = verifyKindExistance(kindId, db);
    MojErrCheck(err);

    //store shard info
    err = db.shardEngine()->put(shard);
    MojErrCheck(err);

    //add record
    MojObject record;
    err = record.putString(_T("_kind"), kindId.data());
    MojErrCheck(err);

    //add value
    MojObject objId(static_cast<MojInt32>(shard.id));
    err = record.put(_T("recId"), objId);
    MojErrCheck(err);

    //put
    MojString strShardId;
    MojDbShardEngine::convertId(shard.id, strShardId);
    err = db.put(record, MojDb::FlagNone, MojDbReq(), strShardId);
    MojErrCheck(err);

    return MojErrNone;
}
Katapult::Katapult()
    : KSystemTray(0, "katapultSysTray"),
      DCOPObject("Katapult")
{
    // Register with DCOP
    kapp->dcopClient()->registerAs("katapult", false);
    kapp->dcopClient()->setDefaultObject(objId());

    setPixmap(KGlobal::iconLoader()->loadIcon("katapult", KIcon::Small));

    display = 0;
    globalAccel = 0;
    actions = 0;
    action = 0;
    executing = FALSE;
    _query = "";

    settings = new KatapultSettings();

    loadCatalogPlugins();
    initDisplay();

    hideTimer = new QTimer(this);
    connect(hideTimer, SIGNAL(timeout()), this, SLOT(hideLauncher()));
    clearTimer = new QTimer(this);
    connect(clearTimer, SIGNAL(timeout()), this, SLOT(clearQuery()));

    connect(settings, SIGNAL(catalogsChanged()), this, SLOT(loadCatalogPlugins()));
    connect(settings, SIGNAL(displayChanged()), this, SLOT(initDisplay()));
    connect(settings, SIGNAL(systrayChanged()), this, SLOT(updateSystray()));

    if(settings->systrayIcon())
    {
        show();
    }

}
示例#13
0
  BuffersFixture() {
    const std::string path( "C:\\temp\\test" );
    BOOST_TEST_MESSAGE( "Creating a test directory: " << path );
    bool ret = OsEnsureDirectory( path );
    if ( ret ) {
      BOOST_TEST_MESSAGE( "Directory was created" );
    } else {
      BOOST_TEST_MESSAGE( "Directory already existed" );
    }
    BOOST_TEST_MESSAGE( "Generate object id:s" );
    for ( size_t i = 0; i < noOfBuffers; ++i ) {
      // Generate object id:s between 10 and 29 bytes.
      // Some object id:s may get the same value!
      size_t objectIdSize = ( rand() % 20 + 10 );

      Cache::ObjectId objId( objectIdSize );
      for ( size_t j = 0; j < objectIdSize; ++j ) {
        // Generate numbers between 0 and 0xFF
        objId[j] = ( rand() % 0x100 );
      }
      objectIds_.push_back( objId );
    }

    BOOST_TEST_MESSAGE( "Creating som buffers to play around with" );
    for ( size_t i = 0; i < noOfBuffers; ++i ) {
      // Generate buffers between 1 and 10 000 bytes.
      size_t bufferSize = ( rand() % 10000 + 1 );

      BinaryBuffer buf( bufferSize );
      for ( size_t j = 0; j < bufferSize; ++j ) {
        // Generate numbers between 0 and 0xFF
        buf[j] = ( rand() % 0x100 );
      }
      buffers_.push_back( buf );
    }
  }
TInt DISICLTransceiver::RouteISIMessage(
        TDes8& aMessage,
        TBool aDynamicSenderCheckNeeded
        )
    {
    C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage 0x%x 0x%x> len %d" ), &aMessage, aDynamicSenderCheckNeeded, aMessage.Length() ) );
    const TUint8* msgPtr = aMessage.Ptr();
    ISIMESSAGE_TRACE( aMessage );
    TInt error( ValidateISIMessage( aMessage ) );
    if( KErrNone != error )
        {
        TRACE_ASSERT_ALWAYS;
        C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage invalid message 0x%x" ), &aMessage ) );
        MemApi::DeallocBlock( aMessage );
        }
    else
        {
        TBool sendOk( EFalse );
        if ( aDynamicSenderCheckNeeded )// Save dynamic device ids from PN_DEV_OWN
            {
            C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage from ISI Router" ) ) );
            TUint8 txDeviceIdentifier = GET_SENDER_DEV( aMessage );
            if ( DynamicDevice( txDeviceIdentifier ) )
                {
                C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage from ISI Router Dynamic Dev" ) ) );                
                UpdateDynamicDeviceTable( txDeviceIdentifier, PN_DEV_OWN );
#ifndef USE_MEDIAAPI 				
                ASSERT_RESET_ALWAYS( txDeviceIdentifier == PN_DEV_PC, 0xdeaddead );// only supported PN_DEV_PC with EIscNokiaUsbPhonetLink
#endif /* USE_MEDIAAPI */  					
                }
            }

        TUint8 rxDeviceIdentifier = GET_RECEIVER_DEV( aMessage );
        C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage rxDeviceIdentifier 0x%x" ), rxDeviceIdentifier ) );
        
        if ( DynamicDevice( rxDeviceIdentifier ) )
            {            
            DynamicToStaticDevice( rxDeviceIdentifier );            
            C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage rxDeviceIdentifier after 0x%x" ), rxDeviceIdentifier ) );
            }


        if( rxDeviceIdentifier == PN_DEV_OWN )
            {
            C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage PN_DEV_OWN 0x%x" ), &aMessage ) );
            TUint16 objId(0xffff);
#ifndef USE_MEDIAAPI 
            if ( GET_RECEIVER_DEV( aMessage ) == PN_DEV_PC )
                {
                C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage to PN_DEV_PC in PN_DEV_OWN" )) );
                objId = EIscNokiaUsbPhonetLink;
                }
            else
                {
                objId = GET_RECEIVER_OBJ( aMessage );
                }
#endif /* USE_MEDIAAPI */  					
#ifdef USE_MEDIAAPI 
            objId = GET_RECEIVER_OBJ( aMessage );
#endif /* USE_MEDIAAPI */  				
            sendOk = iShRouter.Receive( aMessage, objId );
            C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage PN_DEV_OWN 0x%x ok %d" ), &aMessage, sendOk ) );
            }        
        else
            {
            C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage Not PN_DEV_OWN 0x%x" ), &aMessage ) );
            MISIRouterLinkIf* link = NULL;


            const TInt count( iShDevices.Count() );
            for( TInt index( 0 ); index < count; index++ )
                {
                DISIDevice* tmpDevice = iShDevices[ index ];
                ASSERT_RESET_ALWAYS( tmpDevice, ( EISICLTransceiverNULLPtr4 | EDISICLTransceiverTraceId << KClassIdentifierShift ) );
                tmpDevice->LockDeviceFM();
                if( tmpDevice->GetDeviceIdentifier() == rxDeviceIdentifier ) 
                    {
                    link = tmpDevice->GetLink();
                    tmpDevice->FreeDeviceFM();
#ifndef USE_MEDIAAPI 					
                    sendOk = link->Send( aMessage );
                    break;
#endif /* USE_MEDIAAPI */  	
#ifdef USE_MEDIAAPI 						
                    if ( GET_RECEIVER_DEV( aMessage ) == PN_DEV_PC )
                        {
                        C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage PN_DEV_PC %d, %d" ), link->GetTrxId(), iDevPcLastSendTrxId ) ); 	
                        if(iDevPcLastSendTrxId < EAmountOfTrxs)
                            {	
                            if ( link->GetTrxId() ==	iDevPcLastSendTrxId )
                                {
                                if (link->StateConnected())
                                    {
                                    C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage PN_DEV_PC %d, Msg mediaid 0x%x" ), link->GetTrxId(), msgPtr[ ISI_HEADER_OFFSET_MEDIA ] ) ); 
                                    sendOk = link->Send( aMessage );
                                    break;
                                    }
                                }
                            }    
                        else
                            {
                            break;	
                            }		   	
		                 }
                    else
                    	{    			
                        sendOk = link->Send( aMessage );
                        break;
                        }
#endif /* USE_MEDIAAPI */  							
                    }    
                else
                    {
                    tmpDevice->FreeDeviceFM();
                    }
                }
            C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage Not PN_DEV_OWN ok %d" ), &aMessage, sendOk ) );
            }
        if( !sendOk )
            {
            TRACE_ASSERT_ALWAYS;
            error = SendCommIsaEntityNotReachableResp( aMessage );
            }
        }
    C_TRACE( ( _T( "DISICLTransceiver::RouteISIMessage 0x%x<" ), &aMessage ) );
    return error;
    }
示例#15
0
// -----------------------------------------------------------------------------
// Updates the overlay with info from [line]
// -----------------------------------------------------------------------------
void LineInfoOverlay::update(MapLine* line)
{
	if (!line)
		return;

	// info.clear();
	string info_text;
	auto   map_format = MapEditor::editContext().mapDesc().format;

	// General line info
	if (Global::debug)
		info_text += (fmt::format("Line #{} ({})\n", line->index(), line->objId()));
	else
		info_text += (fmt::format("Line #{}\n", line->index()));
	info_text += (fmt::format("Length: {}\n", MathStuff::round(line->length())));

	// Line special
	int as_id = line->special();
	if (line->props().propertyExists("macro"))
	{
		int macro = line->intProperty("macro");
		info_text += (fmt::format("Macro: #{}\n", macro));
	}
	else
		info_text += (fmt::format("Special: {} ({})\n", as_id, Game::configuration().actionSpecialName(as_id)));

	// Line trigger
	if (map_format == MapFormat::Hexen || map_format == MapFormat::UDMF)
		info_text += (fmt::format("Trigger: {}\n", Game::configuration().spacTriggerString(line, map_format)));

	// Line args (or sector tag)
	if (map_format == MapFormat::Hexen || map_format == MapFormat::UDMF)
	{
		string argxstr[2];
		argxstr[0]    = line->stringProperty("arg0str");
		argxstr[1]    = line->stringProperty("arg1str");
		string argstr = Game::configuration().actionSpecial(as_id).argSpec().stringDesc(line->args().data(), argxstr);
		if (!argstr.empty())
			info_text += (fmt::format("{}", argstr));
		else
			info_text += ("No Args");
	}
	else
		info_text += (fmt::format("Sector Tag: {}", line->arg(0)));

	// Line flags
	if (map_format != MapFormat::UDMF)
		info_text += (fmt::format("\nFlags: {}", Game::configuration().lineFlagsString(line)));

	// Setup text box
	text_box_.setText(info_text);

	// Check needed textures
	int needed_tex = line->needsTexture();

	// Front side
	auto s = line->s1();
	if (s)
	{
		side_front_.exists = true;
		if (Global::debug)
			side_front_.info = fmt::format(
				"Front Side #{} ({}) (Sector {})", s->index(), s->objId(), s->sector()->index());
		else
			side_front_.info = fmt::format("Front Side #{} (Sector {})", s->index(), s->sector()->index());
		side_front_.offsets      = fmt::format("Offsets: ({}, {})", s->texOffsetX(), s->texOffsetY());
		side_front_.tex_upper    = s->texUpper();
		side_front_.tex_middle   = s->texMiddle();
		side_front_.tex_lower    = s->texLower();
		side_front_.needs_lower  = ((needed_tex & MapLine::Part::FrontLower) > 0);
		side_front_.needs_middle = ((needed_tex & MapLine::Part::FrontMiddle) > 0);
		side_front_.needs_upper  = ((needed_tex & MapLine::Part::FrontUpper) > 0);
	}
	else
		side_front_.exists = false;

	// Back side
	s = line->s2();
	if (s)
	{
		side_back_.exists = true;
		if (Global::debug)
			side_back_.info = fmt::format(
				"Back Side #{} ({}) (Sector {})", s->index(), s->objId(), s->sector()->index());
		else
			side_back_.info = fmt::format("Back Side #{} (Sector {})", s->index(), s->sector()->index());
		side_back_.offsets      = fmt::format("Offsets: ({}, {})", s->texOffsetX(), s->texOffsetY());
		side_back_.tex_upper    = s->texUpper();
		side_back_.tex_middle   = s->texMiddle();
		side_back_.tex_lower    = s->texLower();
		side_back_.needs_lower  = ((needed_tex & MapLine::Part::BackLower) > 0);
		side_back_.needs_middle = ((needed_tex & MapLine::Part::BackMiddle) > 0);
		side_back_.needs_upper  = ((needed_tex & MapLine::Part::BackUpper) > 0);
	}
	else
		side_back_.exists = false;
}