KLinPopup::KLinPopup()
	: KMainWindow( 0, "KLinPopup" ),
	  m_view(new KLinPopupView(this)), watcher(0),
	  unreadMessages(0), hasInotify(true)
{
	setFocusPolicy(QWidget::StrongFocus);

	// tell the KMainWindow that this is indeed the main widget
	setCentralWidget(m_view);

	// then, setup our actions
	setupActions();

	// apply the saved mainwindow settings, if any, and ask the mainwindow
	// to automatically save settings if changed: window size, toolbar
	// position, icon size, etc.
	setAutoSaveSettings();

	cfg = KGlobal::config();
	readConfig();

	initSystemTray();

	// allow the view to change the statusbar and caption
	connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)),
			this,   SLOT(changeStatusbar(const QString&)));
	connect(m_view, SIGNAL(signalChangeCaption(const QString&)),
			this,   SLOT(changeCaption(const QString&)));


	updateStats();
	checkSmbclientBin();

	messageList.setAutoDelete(true);

	// use a timer to finish the constructor ASAP
	QTimer *watchTimer = new QTimer(this);
	connect(watchTimer, SIGNAL(timeout()), this, SLOT(startWatch()));
	watchTimer->start(1, true);
}
KLinPopup::KLinPopup()
	: KXmlGuiWindow(),
	  m_view(new KLinPopupView(this)), currentMessage(0), unreadMessages(0),
	  m_hostName(QString()), m_arLabel(new QLabel(this))
{
	setCentralWidget(m_view);
	setFocusPolicy(Qt::WheelFocus);
	setupActions();
	setAutoSaveSettings();
	m_view->setFocus();

	cfg = new KConfig("klinpopuprc");
	readConfig();

	initSystemTray();

	// allow the view to change the statusbar and caption
	connect(m_view, SIGNAL(signalChangeStatusbar(const QString &)),
			this, SLOT(changeStatusbar(const QString&)));
	connect(m_view, SIGNAL(signalChangeCaption(const QString &)),
			this, SLOT(setCaption(const QString&)));

	statusBar()->insertItem(QString(), ID_STATUS_TEXT, 1);
	m_arOffPic = KStandardDirs::locate("data", "klinpopup/ar_off.png");
	m_arOnPic = KStandardDirs::locate("data", "klinpopup/ar_on.png");
	m_arLabel->setPixmap(QPixmap(m_arOffPic));
	m_arLabel->setToolTip(i18n("Autoreply off"));
	m_arLabel->setFixedSize(30, 13);
	statusBar()->addPermanentWidget(m_arLabel);

	readSavedMessages();
	showPopup();
	popupHelper();
	checkSmbclientBin();

	// use a timer to finish the constructor ASAP
	QTimer::singleShot(1, this, SLOT(startDirLister()));
}
Exemple #3
0
void CTalkMasterConsoleDlg::showSystemTray()
{
	initSystemTray();
	Shell_NotifyIcon( NIM_ADD, &m_nid );
}