Commit 29adb937 authored by David Jarvie's avatar David Jarvie

Rename class KAlarmMainWindow -> MainWindow

svn path=/trunk/kdepim/; revision=369735
parent 2ec00fec
......@@ -51,14 +51,14 @@ namespace KAlarm
/******************************************************************************
* Display a main window with the specified event selected.
*/
KAlarmMainWindow* displayMainWindowSelected(const QString& eventID)
MainWindow* displayMainWindowSelected(const QString& eventID)
{
KAlarmMainWindow* win = KAlarmMainWindow::firstWindow();
MainWindow* win = MainWindow::firstWindow();
if (!win)
{
if (theApp()->checkCalendarDaemon()) // ensure calendar is open and daemon started
{
win = KAlarmMainWindow::create();
win = MainWindow::create();
win->show();
}
}
......@@ -348,7 +348,7 @@ void resetDaemonIfQueued()
}
}
KAlarmMainWindow::refresh();
MainWindow::refresh();
if (!Daemon::reset())
Daemon::start();
resetDaemonQueued = false;
......
......@@ -28,7 +28,7 @@ class KAction;
class KActionCollection;
namespace KCal { class Event; }
class KAEvent;
class KAlarmMainWindow;
class MainWindow;
class AlarmListView;
namespace KAlarm
......@@ -36,7 +36,7 @@ namespace KAlarm
enum FileType { Unknown, TextPlain, TextFormatted, TextApplication, Image };
KAlarmMainWindow* displayMainWindowSelected(const QString& eventID = QString::null);
MainWindow* displayMainWindowSelected(const QString& eventID = QString::null);
bool readConfigWindowSize(const char* window, QSize&);
void writeConfigWindowSize(const char* window, const QSize&);
FileType fileType(const QString& mimetype);
......
......@@ -189,13 +189,13 @@ bool KAlarmApp::restoreSession()
quitIf(1, true); // error opening the main calendar - quit
return true;
}
KAlarmMainWindow* trayParent = 0;
MainWindow* trayParent = 0;
for (int i = 1; KMainWindow::canBeRestored(i); ++i)
{
QString type = KMainWindow::classNameOfToplevel(i);
if (type == QString::fromLatin1("KAlarmMainWindow"))
if (type == QString::fromLatin1("MainWindow"))
{
KAlarmMainWindow* win = KAlarmMainWindow::create(true);
MainWindow* win = MainWindow::create(true);
win->restore(i, false);
if (win->isHiddenTrayParent())
trayParent = win;
......@@ -217,7 +217,7 @@ bool KAlarmApp::restoreSession()
// Try to display the system tray icon if it is configured to be autostarted,
// or if we're in run-in-system-tray mode.
if (Preferences::instance()->autostartTrayIcon()
|| KAlarmMainWindow::count() && wantRunInSystemTray())
|| MainWindow::count() && wantRunInSystemTray())
displayTrayIcon(true, trayParent);
--mActiveCount;
......@@ -673,7 +673,7 @@ int KAlarmApp::newInstance()
break;
}
(KAlarmMainWindow::create())->show();
(MainWindow::create())->show();
}
} while (0); // only execute once
......@@ -707,7 +707,7 @@ void KAlarmApp::quitIf(int exitCode, bool force)
if (force)
{
// Quit regardless, except for message windows
KAlarmMainWindow::closeAll();
MainWindow::closeAll();
displayTrayIcon(false);
if (MessageWin::instanceCount())
return;
......@@ -718,8 +718,8 @@ void KAlarmApp::quitIf(int exitCode, bool force)
mPendingQuit = false;
if (mActiveCount > 0 || MessageWin::instanceCount())
return;
int mwcount = KAlarmMainWindow::count();
KAlarmMainWindow* mw = mwcount ? KAlarmMainWindow::firstWindow() : 0;
int mwcount = MainWindow::count();
MainWindow* mw = mwcount ? MainWindow::firstWindow() : 0;
if (mwcount > 1 || mwcount && (!mw->isHidden() || !mw->isTrayParent()))
return;
// There are no windows left except perhaps a main window which is a hidden tray icon parent
......@@ -920,7 +920,7 @@ void KAlarmApp::removeWindow(TrayWindow*)
/******************************************************************************
* Display or close the system tray icon.
*/
bool KAlarmApp::displayTrayIcon(bool show, KAlarmMainWindow* parent)
bool KAlarmApp::displayTrayIcon(bool show, MainWindow* parent)
{
static bool creating = false;
if (show)
......@@ -929,13 +929,13 @@ bool KAlarmApp::displayTrayIcon(bool show, KAlarmMainWindow* parent)
{
if (!mKDEDesktop)
return false;
if (!KAlarmMainWindow::count() && wantRunInSystemTray())
if (!MainWindow::count() && wantRunInSystemTray())
{
creating = true; // prevent main window constructor from creating an additional tray icon
parent = KAlarmMainWindow::create();
parent = MainWindow::create();
creating = false;
}
mTrayWindow = new TrayWindow(parent ? parent : KAlarmMainWindow::firstWindow());
mTrayWindow = new TrayWindow(parent ? parent : MainWindow::firstWindow());
connect(mTrayWindow, SIGNAL(deleted()), SIGNAL(trayIconToggled()));
mTrayWindow->show();
emit trayIconToggled();
......@@ -1008,7 +1008,7 @@ bool KAlarmApp::checkSystemTray()
/******************************************************************************
* Return the main window associated with the system tray icon.
*/
KAlarmMainWindow* KAlarmApp::trayMainWindow() const
MainWindow* KAlarmApp::trayMainWindow() const
{
return mTrayWindow ? mTrayWindow->assocMainWindow() : 0;
}
......@@ -1024,7 +1024,7 @@ void KAlarmApp::slotPreferencesChanged()
{
// The system tray run mode has changed
++mActiveCount; // prevent the application from quitting
KAlarmMainWindow* win = mTrayWindow ? mTrayWindow->assocMainWindow() : 0;
MainWindow* win = mTrayWindow ? mTrayWindow->assocMainWindow() : 0;
delete mTrayWindow; // remove the system tray icon if it is currently shown
mTrayWindow = 0;
mOldRunInSystemTray = newRunInSysTray;
......@@ -1055,7 +1055,7 @@ void KAlarmApp::slotPreferencesChanged()
|| preferences->showTimeToAlarm() != mPrefsShowTimeTo)
{
// The default alarm list time columns selection has changed
KAlarmMainWindow::updateTimeColumns(mPrefsShowTime, mPrefsShowTimeTo);
MainWindow::updateTimeColumns(mPrefsShowTime, mPrefsShowTimeTo);
mPrefsShowTime = preferences->showAlarmTime();
mPrefsShowTimeTo = preferences->showTimeToAlarm();
}
......@@ -1078,7 +1078,7 @@ void KAlarmApp::slotPreferencesChanged()
if (mRefreshExpiredAlarms)
{
mRefreshExpiredAlarms = false;
KAlarmMainWindow::updateExpired();
MainWindow::updateExpired();
}
}
......@@ -1101,7 +1101,7 @@ void KAlarmApp::changeStartOfDay()
void KAlarmApp::slotExpiredPurged()
{
mRefreshExpiredAlarms = false;
KAlarmMainWindow::updateExpired();
MainWindow::updateExpired();
}
/******************************************************************************
......
......@@ -36,7 +36,7 @@ class DcopHandler;
class DcopHandlerOld;
#endif
class AlarmCalendar;
class KAlarmMainWindow;
class MainWindow;
class AlarmListView;
class MessageWin;
class TrayWindow;
......@@ -63,10 +63,10 @@ class KAlarmApp : public KUniqueApplication
void addWindow(TrayWindow* w) { mTrayWindow = w; }
void removeWindow(TrayWindow*);
TrayWindow* trayWindow() const { return mTrayWindow; }
KAlarmMainWindow* trayMainWindow() const;
bool displayTrayIcon(bool show, KAlarmMainWindow* = 0);
MainWindow* trayMainWindow() const;
bool displayTrayIcon(bool show, MainWindow* = 0);
bool trayIconDisplayed() const { return !!mTrayWindow; }
bool editNewAlarm(KAlarmMainWindow* = 0);
bool editNewAlarm(MainWindow* = 0);
virtual void commitData(QSessionManager&);
void* execAlarm(KAEvent&, const KAAlarm&, bool reschedule, bool allowDefer = true, bool noPreAction = false);
......
This diff is collapsed.
......@@ -33,30 +33,30 @@ class AlarmListView;
class TemplateDlg;
class KAlarmMainWindow : public MainWindowBase
class MainWindow : public MainWindowBase
{
Q_OBJECT
public:
static KAlarmMainWindow* create(bool restored = false);
~KAlarmMainWindow();
bool isTrayParent() const;
bool isHiddenTrayParent() const { return mHiddenTrayParent; }
bool showingExpired() const { return mShowExpired; }
void selectEvent(const QString& eventID);
static MainWindow* create(bool restored = false);
~MainWindow();
bool isTrayParent() const;
bool isHiddenTrayParent() const { return mHiddenTrayParent; }
bool showingExpired() const { return mShowExpired; }
void selectEvent(const QString& eventID);
static void refresh();
static void updateExpired();
static void updateTimeColumns(bool oldTime, bool oldTimeTo);
static void addEvent(const KAEvent&, KAlarmMainWindow*);
static void executeNew(KAlarmMainWindow* = 0, KAEvent::Action = KAEvent::MESSAGE, const AlarmText& = AlarmText());
static void executeDragEnterEvent(QDragEnterEvent*);
static void executeDropEvent(KAlarmMainWindow*, QDropEvent*);
static void closeAll();
static KAlarmMainWindow* toggleWindow(KAlarmMainWindow*);
static KAlarmMainWindow* mainMainWindow();
static KAlarmMainWindow* firstWindow() { return mWindowList.first(); }
static int count() { return mWindowList.count(); }
static void refresh();
static void updateExpired();
static void updateTimeColumns(bool oldTime, bool oldTimeTo);
static void addEvent(const KAEvent&, MainWindow*);
static void executeNew(MainWindow* = 0, KAEvent::Action = KAEvent::MESSAGE, const AlarmText& = AlarmText());
static void executeDragEnterEvent(QDragEnterEvent*);
static void executeDropEvent(MainWindow*, QDropEvent*);
static void closeAll();
static MainWindow* toggleWindow(MainWindow*);
static MainWindow* mainMainWindow();
static MainWindow* firstWindow() { return mWindowList.first(); }
static int count() { return mWindowList.count(); }
static QString i18n_a_ShowAlarmTimes(); // text of 'Show Alarm Times' checkbox, with 'A' shortcut
static QString i18n_t_ShowAlarmTime(); // text of 'Show alarm time' checkbox, with 'T' shortcut
......@@ -110,7 +110,7 @@ class KAlarmMainWindow : public MainWindowBase
void updateActionsMenu();
private:
KAlarmMainWindow(bool restored);
MainWindow(bool restored);
void createListView(bool recreate);
void initActions();
void setEnableText(bool enable);
......@@ -118,9 +118,9 @@ class KAlarmMainWindow : public MainWindowBase
static void setUpdateTimer();
static void enableTemplateMenuItem(bool);
static void alarmWarnings(QWidget* parent, const KAEvent* = 0);
static bool findWindow(KAlarmMainWindow*);
static bool findWindow(MainWindow*);
static QPtrList<KAlarmMainWindow> mWindowList; // active main windows
static QPtrList<MainWindow> mWindowList; // active main windows
static TemplateDlg* mTemplateDlg; // the one and only template dialogue
AlarmListView* mListView;
KAction* mActionTemplates;
......
......@@ -292,7 +292,7 @@ MiscPrefTab::MiscPrefTab(QVBox* frame)
QVBox* vbox = new QVBox(mPage); // this is to control the QWhatsThis text display area
vbox->setSpacing(KDialog::spacingHint());
label = new QLabel(i18n("In non-leap years, repeat yearly February 29th alarms on:"), vbox);
label->setAlignment(Qt::WordBreak | alignment);
label->setAlignment(alignment | Qt::WordBreak);
box = new QHBox(vbox);
box->setSpacing(2*KDialog::spacingHint());
mFeb29 = new QButtonGroup(box);
......@@ -990,14 +990,14 @@ ViewPrefTab::ViewPrefTab(QVBox* frame)
QBoxLayout* layout = new QVBoxLayout(group, marginKDE2 + KDialog::marginHint(), KDialog::spacingHint());
layout->addSpacing(fontMetrics().lineSpacing()/2);
mListShowTime = new QCheckBox(KAlarmMainWindow::i18n_t_ShowAlarmTime(), group, "listTime");
mListShowTime = new QCheckBox(MainWindow::i18n_t_ShowAlarmTime(), group, "listTime");
mListShowTime->setMinimumSize(mListShowTime->sizeHint());
connect(mListShowTime, SIGNAL(toggled(bool)), SLOT(slotListTimeToggled(bool)));
QWhatsThis::add(mListShowTime,
i18n("Specify whether to show in the alarm list, the time at which each alarm is due"));
layout->addWidget(mListShowTime, 0, Qt::AlignAuto);
mListShowTimeTo = new QCheckBox(KAlarmMainWindow::i18n_n_ShowTimeToAlarm(), group, "listTimeTo");
mListShowTimeTo = new QCheckBox(MainWindow::i18n_n_ShowTimeToAlarm(), group, "listTimeTo");
mListShowTimeTo->setMinimumSize(mListShowTimeTo->sizeHint());
connect(mListShowTimeTo, SIGNAL(toggled(bool)), SLOT(slotListTimeToToggled(bool)));
QWhatsThis::add(mListShowTimeTo,
......@@ -1032,14 +1032,14 @@ ViewPrefTab::ViewPrefTab(QVBox* frame)
"Check to enter an upper limit on the number to be displayed."));
grid->addMultiCellWidget(box, 2, 2, 1, 2, Qt::AlignAuto);
mTooltipShowTime = new QCheckBox(KAlarmMainWindow::i18n_m_ShowAlarmTime(), group, "tooltipTime");
mTooltipShowTime = new QCheckBox(MainWindow::i18n_m_ShowAlarmTime(), group, "tooltipTime");
mTooltipShowTime->setMinimumSize(mTooltipShowTime->sizeHint());
connect(mTooltipShowTime, SIGNAL(toggled(bool)), SLOT(slotTooltipTimeToggled(bool)));
QWhatsThis::add(mTooltipShowTime,
i18n("Specify whether to show in the system tray tooltip, the time at which each alarm is due"));
grid->addMultiCellWidget(mTooltipShowTime, 3, 3, 1, 2, Qt::AlignAuto);
mTooltipShowTimeTo = new QCheckBox(KAlarmMainWindow::i18n_l_ShowTimeToAlarm(), group, "tooltipTimeTo");
mTooltipShowTimeTo = new QCheckBox(MainWindow::i18n_l_ShowTimeToAlarm(), group, "tooltipTimeTo");
mTooltipShowTimeTo->setMinimumSize(mTooltipShowTimeTo->sizeHint());
connect(mTooltipShowTimeTo, SIGNAL(toggled(bool)), SLOT(slotTooltipTimeToToggled(bool)));
QWhatsThis::add(mTooltipShowTimeTo,
......@@ -1066,7 +1066,7 @@ ViewPrefTab::ViewPrefTab(QVBox* frame)
"- If unchecked, the window does not interfere with your typing when "
"it is displayed, but it has no title bar and cannot be moved or resized."));
mShowExpiredAlarms = new QCheckBox(KAlarmMainWindow::i18n_s_ShowExpiredAlarms(), mPage, "showExpired");
mShowExpiredAlarms = new QCheckBox(MainWindow::i18n_s_ShowExpiredAlarms(), mPage, "showExpired");
mShowExpiredAlarms->setMinimumSize(mShowExpiredAlarms->sizeHint());
QWhatsThis::add(mShowExpiredAlarms,
i18n("Specify whether to show expired alarms in the alarm list"));
......
......@@ -67,7 +67,7 @@ struct TipItem
= The KDE system tray window.
=============================================================================*/
TrayWindow::TrayWindow(KAlarmMainWindow* parent, const char* name)
TrayWindow::TrayWindow(MainWindow* parent, const char* name)
: KSystemTray((theApp()->wantRunInSystemTray() ? parent : 0), name),
mAssocMainWindow(parent)
{
......@@ -123,7 +123,7 @@ void TrayWindow::contextMenuAboutToShow(KPopupMenu* menu)
*/
void TrayWindow::slotNewAlarm()
{
KAlarmMainWindow::executeNew();
MainWindow::executeNew();
}
/******************************************************************************
......@@ -163,10 +163,10 @@ void TrayWindow::mousePressEvent(QMouseEvent* e)
if (e->button() == LeftButton && !theApp()->wantRunInSystemTray())
{
// Left click: display/hide the first main window
mAssocMainWindow = KAlarmMainWindow::toggleWindow(mAssocMainWindow);
mAssocMainWindow = MainWindow::toggleWindow(mAssocMainWindow);
}
else if (e->button() == MidButton)
KAlarmMainWindow::executeNew(); // display a New Alarm dialog
MainWindow::executeNew(); // display a New Alarm dialog
else
KSystemTray::mousePressEvent(e);
}
......@@ -192,7 +192,7 @@ void TrayWindow::mouseReleaseEvent(QMouseEvent* e)
*/
void TrayWindow::dragEnterEvent(QDragEnterEvent* e)
{
KAlarmMainWindow::executeDragEnterEvent(e);
MainWindow::executeDragEnterEvent(e);
}
/******************************************************************************
......@@ -201,7 +201,7 @@ void TrayWindow::dragEnterEvent(QDragEnterEvent* e)
*/
void TrayWindow::dropEvent(QDropEvent* e)
{
KAlarmMainWindow::executeDropEvent(0, e);
MainWindow::executeDropEvent(0, e);
}
/******************************************************************************
......@@ -288,7 +288,7 @@ void TrayWindow::tooltipAlarmText(QString& text) const
/******************************************************************************
* Called when the associated main window is closed.
*/
void TrayWindow::removeWindow(KAlarmMainWindow* win)
void TrayWindow::removeWindow(MainWindow* win)
{
if (win == mAssocMainWindow)
mAssocMainWindow = 0;
......
......@@ -24,45 +24,45 @@
#include <ksystemtray.h>
class KPopupMenu;
class KAlarmMainWindow;
class MainWindow;
class TrayTooltip;
class TrayWindow : public KSystemTray
{
Q_OBJECT
public:
TrayWindow(KAlarmMainWindow* parent, const char* name = 0);
TrayWindow(MainWindow* parent, const char* name = 0);
~TrayWindow();
void removeWindow(KAlarmMainWindow*);
KAlarmMainWindow* assocMainWindow() const { return mAssocMainWindow; }
void setAssocMainWindow(KAlarmMainWindow* win) { mAssocMainWindow = win; }
bool inSystemTray() const;
void tooltipAlarmText(QString& text) const;
void removeWindow(MainWindow*);
MainWindow* assocMainWindow() const { return mAssocMainWindow; }
void setAssocMainWindow(MainWindow* win) { mAssocMainWindow = win; }
bool inSystemTray() const;
void tooltipAlarmText(QString& text) const;
public slots:
void slotQuit();
void slotQuit();
signals:
void deleted();
void deleted();
protected:
virtual void contextMenuAboutToShow(KPopupMenu*);
virtual void mousePressEvent(QMouseEvent*);
virtual void mouseReleaseEvent(QMouseEvent*);
virtual void dragEnterEvent(QDragEnterEvent*);
virtual void dropEvent(QDropEvent*);
virtual void contextMenuAboutToShow(KPopupMenu*);
virtual void mousePressEvent(QMouseEvent*);
virtual void mouseReleaseEvent(QMouseEvent*);
virtual void dragEnterEvent(QDragEnterEvent*);
virtual void dropEvent(QDropEvent*);
private slots:
void slotNewAlarm();
void slotPreferences();
void setEnabledStatus(bool status);
void slotNewAlarm();
void slotPreferences();
void setEnabledStatus(bool status);
private:
friend class TrayTooltip;
KAlarmMainWindow* mAssocMainWindow; // main window associated with this, or null
QPixmap mPixmapEnabled, mPixmapDisabled;
TrayTooltip* mTooltip;
MainWindow* mAssocMainWindow; // main window associated with this, or null
QPixmap mPixmapEnabled, mPixmapDisabled;
TrayTooltip* mTooltip;
};
#endif // TRAYWINDOW_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment