-rw-r--r-- | korganizer/calendarview.cpp | 7 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 5 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 12 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 5 |
5 files changed, 19 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 5a2482e..17f1659 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -626,64 +626,71 @@ void CalendarView::init() mSuspendTimer = new QTimer( this ); mAlarmTimer = new QTimer( this ); mRecheckAlarmTimer = new QTimer( this ); connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); mAlarmDialog = new AlarmDialog( this ); connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); mAlarmDialog->setServerNotification( false ); mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); #ifndef DESKTOP_VERSION //US listen for arriving address resultsets connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); #endif mDateNavigator->setCalendar( mCalendar ); } CalendarView::~CalendarView() { // kdDebug() << "~CalendarView()" << endl; //qDebug("CalendarView::~CalendarView() "); delete mDialogManager; delete mViewManager; delete mStorage; delete mDateFrame ; delete mEventViewerDialog; //kdDebug() << "~CalendarView() done" << endl; } + +void CalendarView::slotResetFocus() +{ + qDebug(" CalendarView::slotResetFocus() %x", qApp->focusWidget()); + +} + void CalendarView::nextConflict( bool all, bool allday ) { QPtrList<Event> testlist = mCalendar->events(); Event * test = testlist.first(); while ( test ) { test->setTagged( false ); test = testlist.next(); } QTime st ( 0,0,0); if ( mViewManager->currentView() == mViewManager->agendaView() ) st = mViewManager->agendaView()->agenda()->getEndTime(); //qDebug("time %s ", st.toString().latin1()); QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); QDateTime conflict; QDateTime retVal; bool found = false; Event * cE = 0; Event * cE2 = 0; QPtrList<Event> testlist2 = testlist; test = testlist.first(); bool skip = false; topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); while ( test ) { qApp->processEvents(); skip = false; if ( !all ) skip = ( allday != test->doesFloat() ); if ( !skip ) { Event * test2 = testlist2.first(); while ( test2 ) { skip = false; if ( !all ) skip = ( allday != test2->doesFloat() ); diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 799c297..456c2d7 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -172,64 +172,65 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void organizerEventsSelected(bool); /** Emitted when state of events selection has changed and user is attendee*/ void groupEventsSelected(bool); /** Emitted when an incidence gets selected. If the selection is cleared the signal is emitted with 0 as argument. */ void incidenceSelected( Incidence * ); /** Emitted, when a todoitem is selected or deselected. */ void todoSelected( bool ); /** Emitted, when clipboard content changes. Parameter indicates if paste is possible or not. */ void pasteEnabled(bool); /** Emitted, when the number of incoming messages has changed. */ void numIncomingChanged(int); /** Emitted, when the number of outgoing messages has changed. */ void numOutgoingChanged(int); /** Send status message, which can e.g. be displayed in the status bar. */ void statusMessage(const QString &); void calendarViewExpanded( bool ); void updateSearchDialog(); void filtersUpdated(); public slots: + void slotResetFocus(); void nextConflict( bool all, bool allday ); void conflictAll(); void conflictAllday(); void conflictNotAll(); void setCalReadOnly( int id, bool readO ); void checkAlarms(); void checkFiles(); void slotprintSelInc(); void showNextAlarms(); void showOpenError(); void watchSavedFile(); void recheckTimerAlarm(); void checkNextTimerAlarm(); void addAlarm(const QDateTime &qdt, const QString ¬i ); void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); void removeAlarm(const QDateTime &qdt, const QString ¬i ); /** options dialog made a changed to the configuration. we catch this * and notify all widgets which need to update their configuration. */ void updateConfig(); void insertBirthdays(const QString& uid, const QStringList& birthdayList, const QStringList& anniversaryList, const QStringList& realNameList, const QStringList& emailList, const QStringList& assembledNameList, const QStringList& uidList); /** Load calendar from file \a filename. If \a merge is true, load calendar into existing one, if it is false, clear calendar, before loading. Return true, if calendar could be successfully loaded. */ bool openCalendar(QString filename, bool merge=false); diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 779f12e..0dd5ef5 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -1606,65 +1606,68 @@ int KOAgenda::timeToY(const QTime &time) return Y; } /* Return time corresponding to cell y coordinate. Coordinates are rounded to fit into the grid. */ QTime KOAgenda::gyToTime(int gy) { int secondsPerCell = 24 * 60 * 60/ mRows; int timeSeconds = secondsPerCell * gy; QTime time( 0, 0, 0 ); if ( timeSeconds < 24 * 60 * 60 ) { time = time.addSecs(timeSeconds); } else { time.setHMS( 23, 59, 59 ); } return time; } void KOAgenda::setStartHour(int startHour) { int startCell = startHour * mRows / 24; setContentsPos(0,startCell * gridSpacingY()); } QTime KOAgenda::getEndTime() { - return QTime ( (contentsY ()+viewport()->height())*24/contentsHeight ()+1,0,0); + int tim = (contentsY ()+viewport()->height())*24/contentsHeight (); + if ( tim > 23 ) + return QTime ( 23,59,59); + return QTime ( tim,0,0); } void KOAgenda::hideUnused() { // experimental only // return; KOAgendaItem *item; for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { item->hide(); } } KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) { KOAgendaItem *fi; for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { if ( fi->incidence() == event ) { mUnusedItems.remove(); fi->init( event, qd ); return fi; } } fi=mUnusedItems.first(); if ( fi ) { mUnusedItems.remove(); fi->init( event, qd ); return fi; } // qDebug("new KOAgendaItem "); KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 4bedb61..21d5a35 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1,64 +1,62 @@ #include <stdlib.h> #include <qaction.h> #include <qpopupmenu.h> #include <qpainter.h> #include <qwhatsthis.h> #include <qpushbutton.h> #include <qmessagebox.h> #include <qlineedit.h> #include <qtextcodec.h> #include <qfile.h> #include <qdir.h> #include <qapp.h> #include <qfileinfo.h> #include <qlabel.h> #include <qspinbox.h> #include <qcheckbox.h> #include <qmap.h> #include <qwmatrix.h> #include <qtextbrowser.h> #include <qtextstream.h> #ifndef DESKTOP_VERSION #include <qpe/global.h> -#include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> #include <qpe/qpeapplication.h> #include <qtopia/alarmserver.h> #include <qtopia/qcopenvelope_qws.h> #include <unistd.h> // for sleep #else -#include <qmenubar.h> #include <qtoolbar.h> #include <qapplication.h> //#include <resource.h> #endif #include <libkcal/calendarlocal.h> #include <libkcal/todo.h> #include <libkcal/phoneformat.h> #include <libkdepim/ksyncprofile.h> #include <libkdepim/phoneaccess.h> #include <libkcal/kincidenceformatter.h> #include <libkdepim/kpimglobalprefs.h> #include "calendarview.h" #include "koviewmanager.h" #include "datenavigator.h" #include "koagendaview.h" #include "kojournalview.h" #include "koagenda.h" #include "kodialogmanager.h" #include "kdialogbase.h" #include "kapplication.h" #include "kofilterview.h" #include "kstandarddirs.h" #include "koprefs.h" #include "kfiledialog.h" #include "koglobals.h" #include "kglobal.h" #include "ktoolbar.h" #include "klocale.h" #include "kconfig.h" #include "externalapphandler.h" @@ -196,65 +194,65 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : else { if ( p->mToolBarUp ) tbd = Right; else tbd = Left; } if ( KOPrefs::instance()->mUseAppColors ) QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); globalFlagBlockStartup = 1; iconToolBar = new QPEToolBar( this ); addToolBar (iconToolBar , tbd ); #ifdef DESKTOP_VERSION if ( KOPrefs::instance()->mShowIconFilter ) #else if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) #endif { if ( p->mToolBarHorF ) { if ( p->mToolBarUpF ) tbd = Bottom; else tbd = Top; } else { if ( p->mToolBarUpF ) tbd = Right; else tbd = Left; } filterToolBar = new QPEToolBar ( this ); - filterMenubar = new QMenuBar( 0 ); + filterMenubar = new KMenuBar( 0 ); QFontMetrics fm ( filterMenubar->font() ); filterPopupMenu = new QPopupMenu( this ); filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); QString addTest = "A"; filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); #ifdef DESKTOP_VERSION addTest = "AAABBBCCCx"; #else addTest = "AAx"; #endif filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); addToolBar (filterToolBar , tbd ); connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) filterToolBar->hide(); } else { filterToolBar = 0; filterMenubar = 0; filterPopupMenu = 0; } if ( p->mShowIconOnetoolbar ) { viewToolBar = iconToolBar ; navigatorToolBar = iconToolBar ; } else { #ifndef DESKTOP_VERSION setToolBarsMovable( false ); #endif if ( p->mToolBarHorV ) { if ( p->mToolBarUpV ) tbd = Bottom; @@ -653,100 +651,100 @@ void MainWindow::initActions() { //KOPrefs::instance()->mShowFullMenu iconToolBar->clear(); KOPrefs *p = KOPrefs::instance(); //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); QPopupMenu *viewMenu = new QPopupMenu( this ); QPopupMenu *actionMenu = new QPopupMenu( this ); mCurrentItemMenu = new QPopupMenu ( this ); QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); QPopupMenu *importMenu = new QPopupMenu( this ); QPopupMenu *importMenu_X = new QPopupMenu( this ); QPopupMenu *exportMenu_X = new QPopupMenu( this ); QPopupMenu *beamMenu_X = new QPopupMenu( this ); selectFilterMenu = new QPopupMenu( this ); selectFilterMenu->setCheckable( true ); syncMenu = new QPopupMenu( this ); configureAgendaMenu = new QPopupMenu( this ); configureToolBarMenu = new QPopupMenu( this ); QPopupMenu *helpMenu = new QPopupMenu( this ); QIconSet icon; int pixWid = 22, pixHei = 22; QString pathString = ""; if ( !p->mToolBarMiniIcons ) { if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { pathString += "icons16/"; pixWid = 18; pixHei = 16; } } else { pathString += "iconsmini/"; pixWid = 18; pixHei = 16; } + KMenuBar *menuBar1; if ( KOPrefs::instance()->mShowFullMenu ) { - QMenuBar *menuBar1; - menuBar1 = menuBar(); + menuBar1 = new KMenuBar( this );//menuBar(); menuBar1->insertItem( i18n("File"), importMenu ); menuBar1->insertItem( i18n("View"), viewMenu ); menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); menuBar1->insertItem( i18n("Action"), actionMenu ); #ifdef DESKTOP_VERSION menuBar1->insertItem( i18n("Synchronize"), syncMenu ); menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); #else menuBar1->insertItem( i18n("Sync"), syncMenu ); menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); #endif //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); menuBar1->insertItem( i18n("Help"), helpMenu ); } else { - QPEMenuBar *menuBar1; - menuBar1 = new QPEMenuBar( iconToolBar ); + menuBar1 = new KMenuBar( iconToolBar ); QPopupMenu *menuBar = new QPopupMenu( this ); icon = loadPixmap( pathString + "z_menu" ); menuBar1->insertItem( icon.pixmap(), menuBar); //menuBar1->insertItem( i18n("ME"), menuBar); menuBar->insertItem( i18n("File"), importMenu ); menuBar->insertItem( i18n("View"), viewMenu ); menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); menuBar->insertItem( i18n("Action"), actionMenu ); menuBar->insertItem( i18n("Synchronize"), syncMenu ); menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); menuBar->insertItem( i18n("Filter"),selectFilterMenu ); menuBar->insertItem( i18n("Help"), helpMenu ); //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); menuBar1->setMaximumSize( menuBar1->sizeHint( )); } + connect ( menuBar1, SIGNAL( lostFocus () ), mView, SLOT ( slotResetFocus() ) ); connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); mWeekBgColor = iconToolBar->backgroundColor(); mWeekPixmap.resize( pixWid , pixHei ); mWeekPixmap.fill( mWeekBgColor ); icon = mWeekPixmap; mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); if ( p-> mShowIconWeekNum ) mWeekAction->addTo( iconToolBar ); mWeekFont = font(); int fontPoint = mWeekFont.pointSize(); QFontMetrics f( mWeekFont ); int fontWid = f.width( "30" ); while ( fontWid > pixWid ) { --fontPoint; mWeekFont.setPointSize( fontPoint ); QFontMetrics f( mWeekFont ); fontWid = f.width( "30" ); //qDebug("dec-- "); } connect( mWeekAction, SIGNAL( activated() ), this, SLOT( weekAction() ) ); connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); if ( p->mShowIconFilterview ) { icon = loadPixmap( pathString + "filter" ); actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); connect( actionFilterMenuTB, SIGNAL( activated() ), diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index d648f14..e2de3ba 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -1,58 +1,57 @@ #ifndef KORGE_MAINWINDOW_H #define KORGE_MAINWINDOW_H #include <qmainwindow.h> #include <qtimer.h> #include <qdict.h> #include <qfile.h> #include <qmenubar.h> #include <qtextstream.h> #include <qregexp.h> #include <libkcal/incidence.h> #include <ksyncmanager.h> +#include <kpopupmenu.h> #ifndef DESKTOP_VERSION #include <qcopchannel_qws.h> #endif class QAction; class CalendarView; class KSyncProfile; #ifdef DESKTOP_VERSION #define QPEToolBar QToolBar -#define QPEMenuBar QMenuBar #endif class QPEToolBar; -class QPEMenuBar; namespace KCal { class CalendarLocal; } using namespace KCal; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow( QWidget *parent = 0, const char *name = 0 ); ~MainWindow(); bool beamReceiveEnabled(); static QString defaultFileName(); static QString syncFileName(); static QString resourcePath(); public slots: void setUsesBigPixmaps ( bool ); void setCaption ( const QString & ); void updateWeekNum(const KCal::DateList &); void updateWeek(QDate); void updateFilterToolbar(); virtual void showMaximized (); void configureAgenda( int ); void recieve( const QCString& msg, const QByteArray& data ); protected slots: void calHint(); void startMultiSync(); void setCaptionToDates(); void weekAction(); @@ -99,65 +98,65 @@ class MainWindow : public QMainWindow void selectFilterPopup( int ); void exportToPhone( int ); void toggleBeamReceive(); void disableBR(bool); signals: void selectWeek ( int ); private slots: void showConfigureAgenda(); void getFile( bool ); void syncFileRequest(); protected: void hideEvent ( QHideEvent * ); QString sentSyncFile(); void displayText( QString, QString); void enableIncidenceActions( bool ); private: bool mBRdisabled; #ifndef DESKTOP_VERSION QCopChannel* infrared; #endif QAction* brAction; KSyncManager* mSyncManager; bool mClosed; void saveOnClose(); bool mFlagKeyPressed; bool mBlockAtStartup; QPEToolBar *iconToolBar; QPEToolBar *viewToolBar; QPEToolBar *navigatorToolBar; QPEToolBar *filterToolBar; - QMenuBar *filterMenubar; + KMenuBar *filterMenubar; QPopupMenu * filterPopupMenu; QPopupMenu * mCurrentItemMenu; void initActions(); void setDefaultPreferences(); void resizeEvent( QResizeEvent* e); void keyPressEvent ( QKeyEvent * ) ; void keyReleaseEvent ( QKeyEvent * ) ; QPopupMenu *configureToolBarMenu; QPopupMenu *selectFilterMenu; QPopupMenu *selectFilterMenuTB; QPopupMenu *configureAgendaMenu, *syncMenu; CalendarLocal *mCalendar; CalendarView *mView; QAction *mNewSubTodoAction; QAction *mWeekAction; QFont mWeekFont; QPixmap mWeekPixmap; QColor mWeekBgColor; QAction *mShowAction; QAction *mEditAction; QAction *mDeleteAction; QAction *mCloneAction; QAction *mMoveAction; QAction *mBeamAction; QAction *mCancelAction; QAction *mPrintSelAction; QAction *mToggleNav; QAction *mToggleFilter; QAction *mToggleAllday; QAction *actionFilterMenuTB; |