summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp8
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/main.cpp6
-rw-r--r--korganizer/mainwindow.cpp59
-rw-r--r--korganizer/mainwindow.h12
5 files changed, 77 insertions, 9 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 884c61a..0306e07 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1213,65 +1213,68 @@ bool CalendarView::syncCalendar(QString filename, int mode)
{
storage->setSaveFormat( new ICalFormat() );
storage->save();
}
}
setModified( true );
}
delete storage;
delete calendar;
if ( syncOK )
updateView();
return syncOK;
}
void CalendarView::syncExternal( int mode )
{
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
qApp->processEvents();
CalendarLocal* calendar = new CalendarLocal();
calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
bool syncOK = false;
bool loadSuccess = false;
PhoneFormat* phoneFormat = 0;
+ emit tempDisableBR(true);
#ifndef DESKTOP_VERSION
SharpFormat* sharpFormat = 0;
if ( mode == 0 ) { // sharp
sharpFormat = new SharpFormat () ;
loadSuccess = sharpFormat->load( calendar, mCalendar );
} else
#endif
if ( mode == 1 ) { // phone
phoneFormat = new PhoneFormat (mCurrentSyncDevice,
mSyncManager->mPhoneDevice,
mSyncManager->mPhoneConnection,
mSyncManager->mPhoneModel);
loadSuccess = phoneFormat->load( calendar,mCalendar);
- } else
- return;
+ } else {
+ emit tempDisableBR(false);
+ return;
+ }
if ( loadSuccess ) {
getEventViewerDialog()->setSyncMode( true );
syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
qApp->processEvents();
if ( syncOK ) {
if ( mSyncManager->mWriteBackFile )
{
QPtrList<Incidence> iL = mCalendar->rawIncidences();
Incidence* inc = iL.first();
if ( phoneFormat ) {
while ( inc ) {
inc->removeID(mCurrentSyncDevice);
inc = iL.next();
}
}
#ifndef DESKTOP_VERSION
if ( sharpFormat )
sharpFormat->save(calendar);
#endif
if ( phoneFormat )
phoneFormat->save(calendar);
iL = calendar->rawIncidences();
inc = iL.first();
@@ -1282,48 +1285,49 @@ void CalendarView::syncExternal( int mode )
if ( loc ) {
loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
}
}
inc = iL.next();
}
Incidence* lse = getLastSyncEvent();
if ( lse ) {
lse->setReadOnly( false );
lse->setDescription( "" );
lse->setReadOnly( true );
}
}
}
setModified( true );
} else {
QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
question, i18n("Ok")) ;
}
delete calendar;
updateView();
+ emit tempDisableBR(false);
return ;//syncOK;
}
bool CalendarView::importBday()
{
#ifndef KORG_NOKABC
#ifdef DESKTOP_VERSION
KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::Iterator it;
int count = 0;
for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
++count;
}
QProgressBar bar(count,0 );
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar.sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 1cd896d..2818ee9 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -96,48 +96,49 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
const char *name = 0 );
virtual ~CalendarView();
Calendar *calendar() { return mCalendar; }
KOViewManager *viewManager();
KODialogManager *dialogManager();
QDate startDate();
QDate endDate();
QWidgetStack *viewStack();
QWidget *leftFrame();
NavigatorBar *navigatorBar();
DateNavigator *dateNavigator();
KDateNavigator *dateNavigatorWidget();
void addView(KOrg::BaseView *);
void showView(KOrg::BaseView *);
KOEventViewerDialog* getEventViewerDialog();
Incidence *currentSelection();
signals:
+ void tempDisableBR(bool);
/** This todo has been modified */
void todoModified(Todo *, int);
/** when change is made to options dialog, the topwidget will catch this
* and emit this signal which notifies all widgets which have registered
* for notification to update their settings. */
void configChanged();
/** emitted when the topwidget is closing down, so that any attached
child windows can also close. */
void closingDown();
/** emitted right before we die */
void closed(QWidget *);
/** Emitted when state of modified flag changes */
void modifiedChanged(bool);
void signalmodified();
/** Emitted when state of read-only flag changes */
void readOnlyChanged(bool);
/** Emitted when the unit of navigation changes */
void changeNavStringPrev(const QString &);
void changeNavStringNext(const QString &);
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 16186c0..c8a55d2 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -59,50 +59,46 @@ int main( int argc, char **argv )
printf(" -showWeek: Week view\n");
printf(" -showTodo: Todo view\n");
printf(" -showJournal: Journal view\n");
printf(" -showKO: Next Days view\n");
printf(" -showWNext: What's Next view\n");
printf(" -showNextXView: Next X View\n");
printf(" -new[Y] and -show[X] may be used togehther\n");
printf(" KO/Pi is exiting now. Bye!\n");
exitHelp = true;
}
}
if ( ! exitHelp ) {
KGlobal::setAppName( "korganizer" );
QString fileName ;
#ifndef DESKTOP_VERSION
fileName = getenv("QPEDIR");
KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
#else
fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
#endif
KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
MainWindow m;
#ifndef DESKTOP_VERSION
- QCopChannel* c1 = new QCopChannel("QPE/Application/datebook",&m, "channel" ) ;
- QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
+
QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
a.showMainWidget(&m );
#else
a.setMainWidget(&m );
m.show();
//m.resize( 800, 600 );
QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
#endif
if ( argc > 1 ) {
QCString command = argv[1];
if ( argc > 2 )
command += argv[2];
qApp->processEvents();
m.recieve(command, QByteArray() );
}
a.exec();
-#ifndef DESKTOP_VERSION
- delete c1;
-#endif
}
qDebug("KO: Bye! ");
}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 02ca523..9e215b9 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -216,94 +216,145 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
qApp->processEvents();
}
}
mView->saveCalendar( defaultFileName() );
newFile = true;
}
QTime neededSaveTime = QDateTime::currentDateTime().time();
mView->openCalendar( defaultFileName() );
int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
qDebug("KO: Calendar loading time: %d ms",msNeeded );
if ( KOPrefs::instance()->mLanguageChanged ) {
KOPrefs::instance()->setCategoryDefaults();
int count = mView->addCategories();
KOPrefs::instance()->mLanguageChanged = false;
}
processIncidenceSelection( 0 );
connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
SLOT( processIncidenceSelection( Incidence * ) ) );
connect( mView, SIGNAL( modifiedChanged( bool ) ),
SLOT( slotModifiedChanged( bool ) ) );
+ connect( mView, SIGNAL( tempDisableBR(bool) ),
+ SLOT( disableBR(bool) ) );
connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
mView->setModified( false );
mBlockAtStartup = false;
mView->setModified( false );
setCentralWidget( mView );
globalFlagBlockStartup = 0;
mView->show();
delete splash;
if ( newFile )
mView->updateConfig();
// qApp->processEvents();
//qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
//fillSyncMenu();
connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
mSyncManager->setDefaultFileName( defaultFileName());
connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
mSyncManager->fillSyncMenu();
mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
if ( showWarning ) {
KMessageBox::information( this,
"You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
qApp->processEvents();
mView->dialogManager()->showSyncOptions();
}
//US listen for result adressed from Ka/Pi
#ifndef DESKTOP_VERSION
connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
#endif
-
+#ifndef DESKTOP_VERSION
+ infrared = 0;
+#endif
+
+ mBRdisabled = false;
+ toggleBeamReceive();
}
MainWindow::~MainWindow()
{
//qDebug("MainWindow::~MainWindow() ");
//save toolbar location
delete mCalendar;
delete mSyncManager;
+ if ( infrared )
+ delete infrared;
+
+
+}
+
+void MainWindow::disableBR(bool b)
+{
+ if ( b ) {
+ if ( infrared ) {
+ toggleBeamReceive();
+ mBRdisabled = true;
+ }
+ } else {
+ if ( mBRdisabled ) {
+ mBRdisabled = false;
+ toggleBeamReceive();
+ }
+ }
+}
+bool MainWindow::beamReceiveEnabled()
+{
+#ifndef DESKTOP_VERSION
+ return ( infrared != 0 );
+#endif
+ return false;
+}
+void MainWindow::toggleBeamReceive()
+{
+ if ( mBRdisabled )
+ return;
+#ifndef DESKTOP_VERSION
+ if ( infrared ) {
+ qDebug("disable BeamReceive ");
+ delete infrared;
+ infrared = 0;
+ brAction->setOn(false);
+ return;
+ }
+ qDebug("enable BeamReceive ");
+ brAction->setOn(true);
+ infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
+ QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
+#endif
}
void MainWindow::showMaximized ()
{
#ifndef DESKTOP_VERSION
if ( ! globalFlagBlockStartup )
if ( mClosed )
mView->goToday();
#endif
QWidget::showMaximized () ;
mClosed = false;
}
void MainWindow::closeEvent( QCloseEvent* ce )
{
if ( ! KOPrefs::instance()->mAskForQuit ) {
saveOnClose();
mClosed = true;
ce->accept();
return;
}
@@ -730,48 +781,54 @@ void MainWindow::initActions()
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
importMenu->insertSeparator();
action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
this );
action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
//LR
QPopupMenu *ex2phone = new QPopupMenu( this );
ex2phone->insertItem(i18n("Complete calendar..."), 1 );
ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
importMenu->insertItem( i18n("Export to phone"), ex2phone );
importMenu->insertSeparator();
action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
#ifndef DESKTOP_VERSION
importMenu->insertSeparator();
+ brAction = new QAction( "beam toggle", i18n("Beam receice enabled"), 0,
+ this );
+ brAction->addTo( importMenu );
+ brAction->setToggleAction (true ) ;
+ connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
+
action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
#else
importMenu->insertSeparator();
icon = loadPixmap( pathString + "print" );
action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ),
this, SLOT( printCal() ) );
icon = loadPixmap( pathString + "print" );
action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ),
this, SLOT( printSel() ) );
#endif
importMenu->insertSeparator();
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index e3383ed..0926313 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,117 +1,127 @@
#ifndef KORGE_MAINWINDOW_H
#define KORGE_MAINWINDOW_H
#include <qmainwindow.h>
#include <qtimer.h>
#include <qdict.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qregexp.h>
#include <libkcal/incidence.h>
#include "simplealarmclient.h"
#include <ksyncmanager.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;
namespace KCal {
class CalendarLocal;
}
using namespace KCal;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
~MainWindow();
+ bool beamReceiveEnabled();
public slots:
virtual void showMaximized ();
void configureAgenda( int );
void recieve( const QCString& msg, const QByteArray& data );
static QString defaultFileName();
static QString syncFileName();
static QString resourcePath();
protected slots:
void setCaptionToDates();
void about();
void licence();
void faq();
void usertrans();
void features();
void synchowto();
void whatsNew();
void keyBindings();
void aboutAutoSaving();;
void aboutKnownBugs();
void processIncidenceSelection( Incidence * );
void importQtopia();
void importBday();
void importOL();
void importIcal();
void importFile( QString, bool );
void quickImportIcal();
void slotModifiedChanged( bool );
void save();
void configureToolBar( int );
void printSel();
void printCal();
void saveCalendar();
void loadCalendar();
void exportVCalendar();
void fillFilterMenu();
void selectFilter( int );
void exportToPhone( int );
+ void toggleBeamReceive();
+ void disableBR(bool);
protected:
void displayText( QString, QString);
void displayFile( QString, QString);
void enableIncidenceActions( bool );
private slots:
QSocket* piSocket;
QString piFileString;
QTime piTime;
void getFile( bool );
void syncFileRequest();
private:
+ bool mBRdisabled;
+#ifndef DESKTOP_VERSION
+ QCopChannel* infrared;
+#endif
+ QAction* brAction;
KSyncManager* mSyncManager;
bool mClosed;
void saveOnClose();
bool mFlagKeyPressed;
bool mBlockAtStartup;
QPEToolBar *iconToolBar;
void initActions();
void setDefaultPreferences();
void keyPressEvent ( QKeyEvent * ) ;
void keyReleaseEvent ( QKeyEvent * ) ;
QPopupMenu *configureToolBarMenu;
QPopupMenu *selectFilterMenu;
QPopupMenu *configureAgendaMenu, *syncMenu;
CalendarLocal *mCalendar;
CalendarView *mView;
QAction *mNewSubTodoAction;
QAction *mShowAction;
QAction *mEditAction;
QAction *mDeleteAction;
QAction *mCloneAction;
QAction *mMoveAction;
QAction *mBeamAction;
QAction *mCancelAction;