コード例 #1
0
ファイル: kbinaryclock.cpp プロジェクト: iegor/kdesktop
/**
 * Constructor, create LED's
 */
KBinaryClock::KBinaryClock(const QString& configFile, Type type, int actions, QWidget *parent, const char *name)
	: KPanelApplet(configFile, type, actions, parent, name), ledWidth(6),
	  _calendar(NULL), _disableCalendar(false), 
		prefs( new Prefs(sharedConfig())), m_tooltip(this)
{
	prefs->readConfig();
	setBackgroundOrigin(AncestorOrigin);
	for(int i=0; i < 4; i++){
		for(int j=0; j < ledWidth;j++){
			KLed *led = new KLed( this );
			led->setBackgroundOrigin(AncestorOrigin);
			ledMatrix[j][i] = led;
		}
	}

	// Why does kicker start out with a size of 800x409?
	// Kicker bug?
	resize(60,42);

	updateClock();
	loadSettings();
	QTimer *timer=new QTimer(this);
	connect (timer, SIGNAL (timeout()), this, SLOT (updateClock()));
	timer->start(500,false);
}
コード例 #2
0
ファイル: quicklauncher.cpp プロジェクト: Fat-Zer/tdebase
QuickLauncher::QuickLauncher(const TQString& configFile, Type type, int actions,
                             TQWidget *parent, const char *name) : 
    KPanelApplet(configFile, type, actions, parent, name)
{
    DCOPObject::setObjId("QuickLauncherApplet");
    DEBUGSTR << endl << endl << endl << "------------" << flush;
    DEBUGSTR << "QuickLauncher::QuickLauncher(" << configFile << ",...)" <<
                endl << flush;

    m_settings = new Prefs(sharedConfig());
    m_settings->readConfig();

    m_needsSave = false;
    m_needsRefresh = false;
    m_refreshEnabled = false;

    m_configDialog = 0;
    m_popup = 0;
    m_appletPopup = 0;
    m_removeAppsMenu = 0;

    m_dragAccepted = false;

    m_buttons = new ButtonGroup;
    m_manager = new FlowGridManager;
    m_newButtons = 0;
    m_oldButtons = 0;
    m_dragButtons = 0;

    m_configAction = new TDEAction(i18n("Configure Quicklauncher..."), "configure", TDEShortcut(),
        TQT_TQOBJECT(this), TQT_SLOT(slotConfigure()), TQT_TQOBJECT(this));

    m_saveTimer = new TQTimer(this, "m_saveTimer");
    connect(m_saveTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(saveConfig()));

    m_popularity = new PopularityStatistics();

    setBackgroundOrigin(AncestorOrigin);

    loadConfig();

    buildPopupMenu();
    m_minPanelDim = std::max(16, m_settings->iconDimChoices()[1]);
    refreshContents();
    setRefreshEnabled(true);

    setAcceptDrops(true);
    //TQToolTip::add(this, i18n("Drop applications here"));
    DEBUGSTR << "    QuickLauncher::QuickLauncher(" << configFile << 
                ",...) END" << endl << flush;

    DCOPClient *dcopClient = TDEApplication::dcopClient();
    dcopClient->connectDCOPSignal(0, "appLauncher", 
        "serviceStartedByStorageId(TQString,TQString)",
        "QuickLauncherApplet",
        "serviceStartedByStorageId(TQString,TQString)",
        false);
    kdDebug() << "Quicklauncher registered DCOP signal" << endl;
}