Example #1
0
Shelfscreen::Shelfscreen()
{
    quit_button = new QPushButton("Quit");
    quit_button->setObjectName("quitbutton");
    quit_button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    connect(quit_button, SIGNAL(clicked()), this, SLOT(quitSlot()));
    layout = 0;
    current_page = 0;
    layout = new QGridLayout(this);
}
Example #2
0
/*
 * This is the constructor for the main widget. It sets up the menu and the
 * TaskMan widget.
 */
TopLevel::TopLevel(QWidget *parent, const char *name, int sfolder)
	: KTMainWindow(name)
{
	/*
	 * create main menu
	 */

	menubar = new MainMenu(this, "MainMenu");
	connect(menubar, SIGNAL(quit()), this, SLOT(quitSlot()));
	// register the menu bar with KTMainWindow
	setMenu(menubar);

	statusbar = new KStatusBar(this, "statusbar");
	statusbar->insertItem(i18n("88888 Processes"), 0);
	statusbar->insertItem(i18n("Memory: 888888 kB used, "
							   "888888 kB free"), 1);
	statusbar->insertItem(i18n("Swap: 888888 kB used, "
							   "888888 kB free"), 2);
	setStatusBar(statusbar);
	// call timerEvent to fill the status bar with real values
	timerEvent(0);

	assert(Kapp);
	setCaption(i18n("KDE Task Manager"));

	// create the tab dialog
	taskman = new TaskMan(this, "", sfolder);

	// register the tab dialog with KTMainWindow as client widget
	setView(taskman);

	connect(taskman, SIGNAL(enableRefreshMenu(bool)),
			menubar, SLOT(enableRefreshMenu(bool)));

	setMinimumSize(KTOP_MIN_W, KTOP_MIN_H);

	/*
	 * Restore size of the dialog box that was used at end of last session.
	 * Due to a bug in Qt we need to set the width to one more than the
	 * defined min width. If this is not done the widget is not drawn
	 * properly the first time. Subsequent redraws after resize are no problem.
	 *
	 * I need to implement some propper session management some day!
	 */
	QString t = Kapp->getConfig()->readEntry(QString("G_Toplevel"));
	if(!t.isNull())
	{
		if (t.length() == 19)
		{ 
			int xpos, ypos, ww, wh;
			sscanf(t.data(), "%04d:%04d:%04d:%04d", &xpos, &ypos, &ww, &wh);
			setGeometry(xpos, ypos,
						ww <= KTOP_MIN_W ? KTOP_MIN_W + 1 : ww,
						wh <= KTOP_MIN_H ? KTOP_MIN_H : wh);
		}
	}

	readProperties(Kapp->getConfig());

	timerID = startTimer(2000);

	// show the dialog box
    show();

	// switch to the selected startup page
    taskman->raiseStartUpPage();
}