summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-07 20:05:18 (UTC)
committer zautrix <zautrix>2005-02-07 20:05:18 (UTC)
commitda5e47069d88fa9aa656423ce4c60bf505728e1c (patch) (side-by-side diff)
treefdbaf29835a028f1204a19fc10dea97d469c0b29
parent456b0246521847635fe98471691ceecae211e0c3 (diff)
downloadkdepimpi-da5e47069d88fa9aa656423ce4c60bf505728e1c.zip
kdepimpi-da5e47069d88fa9aa656423ce4c60bf505728e1c.tar.gz
kdepimpi-da5e47069d88fa9aa656423ce4c60bf505728e1c.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/formatfactory.cpp5
-rw-r--r--kmicromail/libmailwrapper/settings.cpp1
-rw-r--r--korganizer/koagendaitem.cpp2
-rw-r--r--korganizer/korganizer.pro2
-rw-r--r--libkcal/calendar.cpp1
-rw-r--r--libkcal/event.cpp6
-rw-r--r--libkcal/todo.cpp4
-rw-r--r--libkdepim/ksyncmanager.cpp7
-rw-r--r--libkdepim/phoneaccess.cpp2
-rw-r--r--microkde/kapplication.cpp3
-rw-r--r--microkde/kdecore/klibloader.cpp14
-rw-r--r--microkde/kdeui/ktoolbar.cpp2
-rw-r--r--microkde/kdeui/ktoolbar.h2
13 files changed, 21 insertions, 30 deletions
diff --git a/kabc/formatfactory.cpp b/kabc/formatfactory.cpp
index f2f03c6..3ae1c27 100644
--- a/kabc/formatfactory.cpp
+++ b/kabc/formatfactory.cpp
@@ -11,120 +11,121 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kdebug.h>
#include <klocale.h>
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
#include <kstaticdeleter.h>
#include <qfile.h>
#include <qstringlist.h>
#include "vcardformatplugin.h"
#include "formatfactory.h"
using namespace KABC;
FormatFactory *FormatFactory::mSelf = 0;
static KStaticDeleter<FormatFactory> factoryDeleter;
FormatFactory *FormatFactory::self()
{
if ( !mSelf ) {
//US factoryDeleter.setObject( mSelf, new FormatFactory );
mSelf = factoryDeleter.setObject( new FormatFactory );
}
return mSelf;
}
FormatFactory::FormatFactory()
{
mFormatList.setAutoDelete( true );
// dummy entry for default format
FormatInfo *info = new FormatInfo;
info->library = "<NoLibrary>";
info->nameLabel = i18n( "vCard" );
info->descriptionLabel = i18n( "vCard Format" );
mFormatList.insert( "vcard", info );
-/*US lets enter all resources directly instead of using teh desktopfiles.
+#if 0
+US lets enter all resources directly instead of using teh desktopfiles.
QStringList list = KGlobal::dirs()->findAllResources( "data" ,"kabc/formats/*.desktop", true, true );
for ( QStringList::ConstIterator it = list.begin(); it != list.end(); ++it )
{
//US KSimpleConfig config( *it, true );
KConfig config( *it );
if ( !config.hasGroup( "Misc" ) || !config.hasGroup( "Plugin" ) )
continue;
info = new FormatInfo;
config.setGroup( "Plugin" );
QString type = config.readEntry( "Type" );
info->library = config.readEntry( "X-KDE-Library" );
config.setGroup( "Misc" );
info->nameLabel = config.readEntry( "Name" );
info->descriptionLabel = config.readEntry( "Comment", i18n( "No description available." ) );
mFormatList.insert( type, info );
}
-*/
+#endif
//US we already have vcard as default format.
info = new FormatInfo;
info->library = i18n("microkabcformat_binary");
info->nameLabel = i18n( "Binary" );
info->descriptionLabel = i18n( "No description available." );
mFormatList.insert( "binary", info );
}
FormatFactory::~FormatFactory()
{
mFormatList.clear();
}
QStringList FormatFactory::formats()
{
QStringList retval;
// make sure 'vcard' is the first entry
retval << "vcard";
QDictIterator<FormatInfo> it( mFormatList );
for ( ; it.current(); ++it )
if ( it.currentKey() != "vcard" )
retval << it.currentKey();
return retval;
}
FormatInfo *FormatFactory::info( const QString &type )
{
if ( type.isEmpty() )
return 0;
else
return mFormatList[ type ];
}
FormatPlugin *FormatFactory::format( const QString& type )
{
FormatPlugin *format = 0;
if ( type.isEmpty() )
return 0;
if ( type == "vcard" ) {
format = new VCardFormatPlugin;
format->setType( type );
format->setNameLabel( i18n( "vCard" ) );
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index 8f909f9..9436d43 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -74,97 +74,96 @@ void Settings::updateAccounts()
for ( it = pop3.begin(); it != pop3.end(); it++ ) {
POP3account *account = new POP3account( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList smtp = dir.entryList( "smtp-*" );
for ( it = smtp.begin(); it != smtp.end(); it++ ) {
SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
QStringList nntp = dir.entryList( "nntp-*" );
for ( it = nntp.begin(); it != nntp.end(); it++ ) {
NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") );
accounts.append( account );
}
readAccounts();
}
void Settings::saveAccounts()
{
checkDirectory();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
it->save();
}
}
void Settings::readAccounts()
{
checkDirectory();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
it->read();
}
}
Account::Account()
{
accountName = "changeMe";
type = MAILLIB::A_UNDEFINED;
ssl = false;
connectionType = 1;
offline = false;
maxMailSize = 0;
- lastFetch;
leaveOnServer = false;
}
void Account::remove()
{
QFile file( getFileName() );
file.remove();
}
void Account::setPasswordList(const QStringList &str)
{
password = "";
int i;
for ( i = 0; i < str.count() ; ++i ) {
QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3)));
password.append( c );
}
//qDebug("password %s ", password.latin1());
}
QStringList Account::getPasswordList()
{
int i;
int len = password.length();
QStringList str;
for ( i = 0; i < len ; ++i ) {
int val = password.at(i).unicode()*(len-(i%3))+131;
str.append( QString::number( val ) );
// qDebug("append %s ", str[i].latin1());
}
return str;
}
IMAPaccount::IMAPaccount()
: Account()
{
file = IMAPaccount::getUniqueFileName();
accountName = "New IMAP Account";
ssl = false;
connectionType = 1;
type = MAILLIB::A_IMAP;
port = IMAP_PORT;
}
IMAPaccount::IMAPaccount( QString filename )
: Account()
{
file = filename;
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index df7d612..6a312b3 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -272,97 +272,97 @@ void KOAgendaItem::select(bool selected)
}
}
globalFlagBlockAgendaItemUpdate = 0;
paintMe( selected );
globalFlagBlockAgendaItemUpdate = 1;
repaint( false );
}
/*
The eventFilter has to filter the mouse events of the agenda item childs. The
events are fed into the event handling method of KOAgendaItem. This allows the
KOAgenda to handle the KOAgendaItems by using an eventFilter.
*/
bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e )
{
if (e->type() == QEvent::MouseButtonPress ||
e->type() == QEvent::MouseButtonDblClick ||
e->type() == QEvent::MouseButtonRelease ||
e->type() == QEvent::MouseMove) {
QMouseEvent *me = (QMouseEvent *)e;
QPoint itemPos = this->mapFromGlobal(((QWidget *)object)->
mapToGlobal(me->pos()));
QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state());
return event(&returnEvent);
} else {
return false;
}
}
void KOAgendaItem::repaintMe( )
{
paintMe ( mSelected );
}
void KOAgendaItem::paintMe( bool selected, QPainter* paint )
{
if ( globalFlagBlockAgendaItemUpdate && ! selected)
return;
QPainter pa;
if ( mSelected ) {
pa.begin( paintPixSel() );
} else {
if ( mAllDay )
pa.begin( paintPixAllday() );
else
pa.begin( paintPix() );
}
int x, yy, w, h;
- float nfh;
+ float nfh = 7.0;
x = pos().x(); w = width(); h = height ();
if ( mAllDay )
yy = y();
else
yy = mCellYTop * ( height() / cellHeight() );
xPaintCoord= x;
yPaintCoord = yy;
wPaintCoord = width();
hPaintCoord = height();
//qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height());
if ( paint == 0 )
paint = &pa;
bool horLayout = ( w < h );
int maxhei = mFontPixelSize+4;
if ( horLayout )
maxhei += AGENDA_ICON_SIZE -4;
bool small = ( h < maxhei );
if ( ! small )
paint->setFont(KOPrefs::instance()->mAgendaViewFont);
else {
QFont f = KOPrefs::instance()->mAgendaViewFont;
f.setBold( false );
int fh = f.pointSize();
nfh = (((float)height())/(float)(mFontPixelSize+4))*fh;
if ( nfh < 6 )
nfh = 6;
f.setPointSize( nfh );
paint->setFont(f);
}
paint->fillRect ( x, yy, w, h, mBackgroundColor );
static const QPixmap completedPxmp = SmallIcon("greenhook16");
static const QPixmap overduePxmp = SmallIcon("redcross16");
if ( mIncidence->type() == "Todo" ) {
Todo* tempTodo = static_cast<Todo*>(mIncidence);
int xx = pos().x()+(width()-completedPxmp.width()-3 );
int yyy = yy+3;
if ( tempTodo->isCompleted() )
paint->drawPixmap ( xx, yyy, completedPxmp );
else {
paint->drawPixmap ( xx, yyy, overduePxmp );
}
}
bool addIcon = false;
if ( ! small || w > 3 * h || h > 3* w )
addIcon = updateIcons( paint, horLayout );
qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro
index 3c7a1fb..5e82721 100644
--- a/korganizer/korganizer.pro
+++ b/korganizer/korganizer.pro
@@ -1,50 +1,50 @@
TEMPLATE = app
-CONFIG += qt warn_off
+CONFIG += qt warn_on
TARGET = kopi
OBJECTS_DIR = _obj/
MOC_DIR = _moc
DESTDIR= ../bin
include( ../variables.pri )
INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim
#../qtcompat
DEFINES += KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
#KORG_NOPRINTER KORG_NOKABC KORG_NODND
DEFINES += KORG_NOLVALTERNATION
DEFINES += DESKTOP_VERSION
unix : {
LIBS += ../bin/libmicrokdepim.so
LIBS += ../bin/libmicrokcal.so
LIBS += ../bin/libmicrokde.so
LIBS += ../bin/libmicrokabc.so
#LIBS += -lbluetooth
#LIBS += -lsdp
#LIBS += -lldap
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
RC_FILE = winicons.rc
DEFINES += _WIN32_
LIBS += ../bin/microkdepim.lib
LIBS += ../bin/microkcal.lib
LIBS += ../bin/microkde.lib
LIBS += ../bin/microkabc.lib
LIBS += ../libical/lib/ical.lib
LIBS += ../libical/lib/icalss.lib
#LIBS += atls.lib
QMAKE_LINK += /NODEFAULTLIB:LIBC
#QMAKE_LINK += /NODEFAULTLIB:MSVCRT
#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
#olimport section
#blabla: {
LIBS += mfc71u.lib
DEFINES += _OL_IMPORT_
HEADERS += ../outport/msoutl9.h \
koimportoldialog.h
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index 88351eb..dcfee5d 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -79,96 +79,97 @@ void Calendar::init()
now = localtime(&curtime);
int hourOff = - ((timezone / 60) / 60);
if (now->tm_isdst)
hourOff += 1;
QString tzStr;
tzStr.sprintf("%.2d%.2d",
hourOff,
abs((timezone / 60) % 60));
// if no time zone was in the config file, write what we just discovered.
if (tmpStr.isEmpty()) {
// KOPrefs::instance()->mTimeZone = tzStr;
} else {
tzStr = tmpStr;
}
// if daylight savings has changed since last load time, we need
// to rewrite these settings to the config file.
if ((now->tm_isdst && !dstSetting) ||
(!now->tm_isdst && dstSetting)) {
KOPrefs::instance()->mTimeZone = tzStr;
KOPrefs::instance()->mDaylightSavings = now->tm_isdst;
}
setTimeZone(tzStr);
#endif
// KOPrefs::instance()->writeConfig();
}
Calendar::~Calendar()
{
delete mDefaultFilter;
if ( mUndoIncidence )
delete mUndoIncidence;
}
const QString &Calendar::getOwner() const
{
return mOwner;
}
bool Calendar::undoDeleteIncidence()
{
if (!mUndoIncidence)
return false;
addIncidence(mUndoIncidence);
mUndoIncidence = 0;
+ return true;
}
void Calendar::setOwner(const QString &os)
{
int i;
mOwner = os;
i = mOwner.find(',');
if (i != -1)
mOwner = mOwner.left(i);
setModified( true );
}
void Calendar::setTimeZone(const QString & tz)
{
bool neg = FALSE;
int hours, minutes;
QString tmpStr(tz);
if (tmpStr.left(1) == "-")
neg = TRUE;
if (tmpStr.left(1) == "-" || tmpStr.left(1) == "+")
tmpStr.remove(0, 1);
hours = tmpStr.left(2).toInt();
if (tmpStr.length() > 2)
minutes = tmpStr.right(2).toInt();
else
minutes = 0;
mTimeZone = (60*hours+minutes);
if (neg)
mTimeZone = -mTimeZone;
mLocalTime = false;
setModified( true );
}
QString Calendar::getTimeZoneStr() const
{
if (mLocalTime)
return "";
QString tmpStr;
int hours = abs(mTimeZone / 60);
int minutes = abs(mTimeZone % 60);
bool neg = mTimeZone < 0;
tmpStr.sprintf("%c%.2d%.2d",
(neg ? '-' : '+'),
hours, minutes);
return tmpStr;
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index 7256f05..de8dceb 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -44,180 +44,178 @@ Event::~Event()
Incidence *Event::clone()
{
return new Event(*this);
}
bool KCal::operator==( const Event& e1, const Event& e2 )
{
return operator==( (const Incidence&)e1, (const Incidence&)e2 ) &&
e1.dtEnd() == e2.dtEnd() &&
e1.hasEndDate() == e2.hasEndDate() &&
e1.transparency() == e2.transparency();
}
bool Event::contains ( Event* from )
{
if ( !from->summary().isEmpty() )
if ( !summary().startsWith( from->summary() ))
return false;
if ( from->dtStart().isValid() )
if (dtStart() != from->dtStart() )
return false;
if ( from->dtEnd().isValid() )
if ( dtEnd() != from->dtEnd() )
return false;
if ( !from->location().isEmpty() )
if ( !location().startsWith( from->location() ) )
return false;
if ( !from->description().isEmpty() )
if ( !description().startsWith( from->description() ))
return false;
if ( from->alarms().count() ) {
Alarm *a = from->alarms().first();
if ( a->enabled() ){
if ( !alarms().count() )
return false;
Alarm *b = alarms().first();
if( ! b->enabled() )
return false;
if ( ! (a->offset() == b->offset() ))
return false;
}
}
QStringList cat = categories();
QStringList catFrom = from->categories();
QString nCat;
- int iii;
+ unsigned int iii;
for ( iii = 0; iii < catFrom.count();++iii ) {
nCat = catFrom[iii];
if ( !nCat.isEmpty() )
if ( !cat.contains( nCat )) {
return false;
}
}
if ( from->doesRecur() )
if ( from->doesRecur() != doesRecur() && ! (from->doesRecur()== Recurrence::rYearlyMonth && doesRecur()== Recurrence::rYearlyDay) )
return false;
return true;
}
void Event::setDtEnd(const QDateTime &dtEnd)
{
if (mReadOnly) return;
mDtEnd = getEvenTime( dtEnd );
setHasEndDate(true);
setHasDuration(false);
updated();
}
QDateTime Event::dtEnd() const
{
if (hasEndDate()) return mDtEnd;
if (hasDuration()) return dtStart().addSecs(duration());
- kdDebug(5800) << "Warning! Event '" << summary()
- << "' does have neither end date nor duration." << endl;
return dtStart();
}
QString Event::dtEndTimeStr() const
{
return KGlobal::locale()->formatTime(mDtEnd.time());
}
QString Event::dtEndDateStr(bool shortfmt) const
{
return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt);
}
QString Event::dtEndStr(bool shortfmt) const
{
return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt);
}
void Event::setHasEndDate(bool b)
{
mHasEndDate = b;
}
bool Event::hasEndDate() const
{
return mHasEndDate;
}
bool Event::isMultiDay() const
{
bool multi = !(dtStart().date() == dtEnd().date());
return multi;
}
void Event::setTransparency(Event::Transparency transparency)
{
if (mReadOnly) return;
mTransparency = transparency;
updated();
}
Event::Transparency Event::transparency() const
{
return mTransparency;
}
void Event::setDuration(int seconds)
{
setHasEndDate(false);
Incidence::setDuration(seconds);
}
QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const
{
bool yes;
QDateTime incidenceStart = getNextOccurence( QDateTime::currentDateTime(), &yes );
if ( ! yes || cancelled() ) {
*ok = false;
return QDateTime ();
}
bool enabled = false;
Alarm* alarm;
- int off;
+ int off = 0;
QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
// if ( QDateTime::currentDateTime() > incidenceStart ){
// *ok = false;
// return incidenceStart;
// }
for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
if (alarm->enabled()) {
if ( alarm->hasTime () ) {
if ( alarm->time() < alarmStart ) {
alarmStart = alarm->time();
enabled = true;
off = alarmStart.secsTo( incidenceStart );
}
} else {
int secs = alarm->startOffset().asSeconds();
if ( incidenceStart.addSecs( secs ) < alarmStart ) {
alarmStart = incidenceStart.addSecs( secs );
enabled = true;
off = -secs;
}
}
}
}
if ( enabled ) {
if ( alarmStart > QDateTime::currentDateTime() ) {
*ok = true;
* offset = off;
return alarmStart;
}
}
*ok = false;
return QDateTime ();
}
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index d81a68f..9c04a7e 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -51,97 +51,97 @@ Todo::~Todo()
}
Incidence *Todo::clone()
{
return new Todo(*this);
}
bool Todo::contains ( Todo* from )
{
if ( !from->summary().isEmpty() )
if ( !summary().startsWith( from->summary() ))
return false;
if ( from->hasStartDate() ) {
if ( !hasStartDate() )
return false;
if ( from->dtStart() != dtStart())
return false;
}
if ( from->hasDueDate() ){
if ( !hasDueDate() )
return false;
if ( from->dtDue() != dtDue())
return false;
}
if ( !from->location().isEmpty() )
if ( !location().startsWith( from->location() ) )
return false;
if ( !from->description().isEmpty() )
if ( !description().startsWith( from->description() ))
return false;
if ( from->alarms().count() ) {
Alarm *a = from->alarms().first();
if ( a->enabled() ){
if ( !alarms().count() )
return false;
Alarm *b = alarms().first();
if( ! b->enabled() )
return false;
if ( ! (a->offset() == b->offset() ))
return false;
}
}
QStringList cat = categories();
QStringList catFrom = from->categories();
QString nCat;
- int iii;
+ unsigned int iii;
for ( iii = 0; iii < catFrom.count();++iii ) {
nCat = catFrom[iii];
if ( !nCat.isEmpty() )
if ( !cat.contains( nCat )) {
return false;
}
}
if ( from->isCompleted() ) {
if ( !isCompleted() )
return false;
}
if( priority() != from->priority() )
return false;
return true;
}
bool KCal::operator==( const Todo& t1, const Todo& t2 )
{
bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 );
if ( ! ret )
return false;
if ( t1.hasDueDate() == t2.hasDueDate() ) {
if ( t1.hasDueDate() ) {
if ( t1.doesFloat() == t2.doesFloat() ) {
if ( t1.doesFloat() ) {
if ( t1.dtDue().date() != t2.dtDue().date() )
return false;
} else
if ( t1.dtDue() != t2.dtDue() )
return false;
} else
return false;// float !=
}
} else
return false;
if ( t1.percentComplete() != t2.percentComplete() )
return false;
if ( t1.isCompleted() ) {
if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) {
if ( t1.hasCompletedDate() ) {
if ( t1.completed() != t2.completed() )
return false;
}
@@ -330,85 +330,85 @@ QDateTime Todo::completed() const
return mCompleted;
}
QString Todo::completedStr( bool shortF ) const
{
return KGlobal::locale()->formatDateTime(mCompleted, shortF);
}
void Todo::setCompleted(const QDateTime &completed)
{
//qDebug("Todo::setCompleted ");
if ( mHasCompletedDate ) {
// qDebug("has completed data - return ");
return;
}
mHasCompletedDate = true;
mPercentComplete = 100;
mCompleted = getEvenTime(completed);
updated();
}
bool Todo::hasCompletedDate() const
{
return mHasCompletedDate;
}
int Todo::percentComplete() const
{
return mPercentComplete;
}
void Todo::setPercentComplete(int v)
{
mPercentComplete = v;
if ( v != 100 )
mHasCompletedDate = false;
updated();
}
QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const
{
if ( isCompleted() || ! hasDueDate() || cancelled() ) {
*ok = false;
return QDateTime ();
}
QDateTime incidenceStart;
incidenceStart = dtDue();
bool enabled = false;
Alarm* alarm;
- int off;
+ int off = 0;
QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
// if ( QDateTime::currentDateTime() > incidenceStart ){
// *ok = false;
// return incidenceStart;
// }
for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
if (alarm->enabled()) {
if ( alarm->hasTime () ) {
if ( alarm->time() < alarmStart ) {
alarmStart = alarm->time();
enabled = true;
off = alarmStart.secsTo( incidenceStart );
}
} else {
int secs = alarm->startOffset().asSeconds();
if ( incidenceStart.addSecs( secs ) < alarmStart ) {
alarmStart = incidenceStart.addSecs( secs );
enabled = true;
off = -secs;
}
}
}
}
if ( enabled ) {
if ( alarmStart > QDateTime::currentDateTime() ) {
*ok = true;
* offset = off;
return alarmStart;
}
}
*ok = false;
return QDateTime ();
}
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 3adbf61..df5a0d9 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -14,97 +14,97 @@
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
// $Id$
#include "ksyncmanager.h"
#include <stdlib.h>
#ifndef _WIN32_
#include <unistd.h>
#endif
#include "ksyncprofile.h"
#include "ksyncprefsdialog.h"
#include "kpimprefs.h"
#include <kmessagebox.h>
#include <qdir.h>
#include <qprogressbar.h>
#include <qpopupmenu.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qbuttongroup.h>
#include <qtimer.h>
#include <qmessagebox.h>
#include <qapplication.h>
#include <qlineedit.h>
#include <qdialog.h>
#include <qlayout.h>
#include <qtextcodec.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <klocale.h>
#include <kglobal.h>
#include <kconfig.h>
#include <kfiledialog.h>
QDateTime KSyncManager::mRequestedSyncEvent;
KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
- : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu)
+ : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu)
{
mServerSocket = 0;
bar = new QProgressBar ( 1, 0 );
bar->setCaption ("");
mWriteBackInPast = 2;
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 );
if ( mPrefs->mPassiveSyncAutoStart )
enableQuick( false );
}
KSyncManager::~KSyncManager()
{
delete bar;
}
void KSyncManager::fillSyncMenu()
{
if ( mSyncMenu->count() )
mSyncMenu->clear();
mSyncMenu->insertItem( i18n("Configure..."), 0 );
mSyncMenu->insertSeparator();
QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu );
mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 );
clearMenu->insertItem( i18n("For all profiles"), 1 );
clearMenu->insertSeparator();
connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) );
mSyncMenu->insertSeparator();
if ( mServerSocket == 0 ) {
mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
} else {
mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
}
mSyncMenu->insertSeparator();
mSyncMenu->insertItem( i18n("Multiple sync"), 1 );
mSyncMenu->insertSeparator();
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
config.setGroup("General");
QStringList prof = config.readListEntry("SyncProfileNames");
mLocalMachineName = config.readEntry("LocalMachineName","undefined");
@@ -415,193 +415,192 @@ void KSyncManager::enableQuick( bool ask )
return;
}
mPrefs->mPassiveSyncAutoStart = autoStart;
if ( changed ) {
mPrefs->writeConfig();
}
connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
}
void KSyncManager::syncLocalFile()
{
QString fn =mPrefs->mLastSyncedLocalFile;
QString ext;
switch(mTargetApp)
{
case (KAPI):
ext = "(*.vcf)";
break;
case (KOPI):
ext = "(*.ics/*.vcs)";
break;
case (PWMPI):
ext = "(*.pwm)";
break;
default:
qDebug("KSM::syncLocalFile: invalid apptype selected");
break;
}
fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent );
if ( fn == "" )
return;
if ( syncWithFile( fn, false ) ) {
qDebug("KSM::syncLocalFile() successful ");
}
}
bool KSyncManager::syncWithFile( QString fn , bool quick )
{
bool ret = false;
QFileInfo info;
info.setFile( fn );
QString mess;
- bool loadbup = true;
if ( !info. exists() ) {
mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
- int result = QMessageBox::warning( mParent, i18n("Warning!"),
+ QMessageBox::warning( mParent, i18n("Warning!"),
mess );
return ret;
}
int result = 0;
if ( !quick ) {
mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
result = QMessageBox::warning( mParent, i18n("Warning!"),
mess,
i18n("Sync"), i18n("Cancel"), 0,
0, 1 );
if ( result )
return false;
}
if ( mAskForPreferences )
if ( !edit_sync_options()) {
mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
return false;
}
if ( result == 0 ) {
//qDebug("Now sycing ... ");
if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) )
mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") );
else
mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
if ( ! quick )
mPrefs->mLastSyncedLocalFile = fn;
}
return ret;
}
void KSyncManager::quickSyncLocalFile()
{
if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) {
qDebug("KSM::quick syncLocalFile() successful ");
}
}
void KSyncManager::multiSync( bool askforPrefs )
{
if (blockSave())
return;
setBlockSave(true);
QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"),
question,
i18n("Yes"), i18n("No"),
0, 0 ) != 0 ) {
setBlockSave(false);
mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!"));
return;
}
mCurrentSyncDevice = i18n("Multiple profiles") ;
mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
if ( askforPrefs ) {
if ( !edit_sync_options()) {
mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") );
return;
}
mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs;
}
mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") );
qApp->processEvents();
int num = ringSync() ;
if ( num > 1 )
ringSync();
setBlockSave(false);
if ( num )
emit save();
if ( num )
mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) );
else
mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
return;
}
int KSyncManager::ringSync()
{
int syncedProfiles = 0;
unsigned int i;
QTime timer;
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
QStringList syncProfileNames = mSyncProfileNames;
KSyncProfile* temp = new KSyncProfile ();
mAskForPreferences = false;
for ( i = 0; i < syncProfileNames.count(); ++i ) {
mCurrentSyncProfile = i;
temp->setName(syncProfileNames[mCurrentSyncProfile]);
temp->readConfig(&config);
- bool includeInRingSync;
+ bool includeInRingSync = false;
switch(mTargetApp)
{
case (KAPI):
includeInRingSync = temp->getIncludeInRingSyncAB();
break;
case (KOPI):
includeInRingSync = temp->getIncludeInRingSync();
break;
case (PWMPI):
includeInRingSync = temp->getIncludeInRingSyncPWM();
break;
default:
qDebug("KSM::ringSync: invalid apptype selected");
break;
}
if ( includeInRingSync && ( i < 1 || i > 2 )) {
mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
++syncedProfiles;
mSyncWithDesktop = false;
// mAskForPreferences = temp->getAskForPreferences();
mWriteBackFile = temp->getWriteBackFile();
mWriteBackExistingOnly = temp->getWriteBackExisting();
mIsKapiFile = temp->getIsKapiFile();
mWriteBackInFuture = 0;
if ( temp->getWriteBackFuture() ) {
mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
mWriteBackInPast = temp->getWriteBackPastWeeks( );
}
mFilterInCal = temp->getFilterInCal();
mFilterOutCal = temp->getFilterOutCal();
mFilterInAB = temp->getFilterInAB();
mFilterOutAB = temp->getFilterOutAB();
mShowSyncSummary = false;
mCurrentSyncDevice = syncProfileNames[i] ;
mCurrentSyncName = mLocalMachineName;
if ( i == 0 ) {
mIsKapiFile = false;
#ifdef DESKTOP_VERSION
syncKDE();
#else
syncSharp();
#endif
} else {
if ( temp->getIsLocalFileSync() ) {
switch(mTargetApp)
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp
index e24ad9e..89db22b 100644
--- a/libkdepim/phoneaccess.cpp
+++ b/libkdepim/phoneaccess.cpp
@@ -137,80 +137,80 @@ bool PhoneAccess::writeToPhone( QString fileName)
#else
QString command ="./kammu --restore " + fileName ;
#endif
#else
QString command ="kammu --restore " + fileName ;
#endif
int ret = 1;
while ( ret != 0 ) {
QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 );
int w = 235;
int h = status->sizeHint().height()+20 ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
if ( dw > 310 )
w = 310;
status->setCaption(i18n("Writing to phone...") );
status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
status->show();
status->raise();
status->update();
qApp->processEvents();
status->update();
qApp->processEvents();
ret = system ( command.latin1());
delete status;
qApp->processEvents();
if ( ret ) {
qDebug("Error S::command returned %d.", ret);
int retval = KMessageBox::warningContinueCancel(0,
i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel"));
if ( retval != KMessageBox::Continue )
return false;
}
}
return true;
}
bool PhoneAccess::readFromPhone( QString fileName)
{
#ifdef DESKTOP_VERSION
#ifdef _WIN32_
QString command ="kammu --backup " + fileName + " -yes" ;
#else
QString command ="./kammu --backup " + fileName + " -yes" ;
#endif
#else
QString command ="kammu --backup " + fileName + " -yes" ;
#endif
- int ret;
+ int ret = 1;
while ( ret != 0 ) {
QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 );
int w = 235;
int h = status->sizeHint().height()+20 ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
if ( dw > 310 )
w = 310;
status->setCaption(i18n("Reading from phone...") );
status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
status->show();
status->raise();
status->update();
qApp->processEvents();
status->update();
qApp->processEvents();
ret = system ( command.latin1() );
delete status;
qApp->processEvents();
if ( ret ) {
qDebug("Error reading from phone:Command returned %d", ret);
int retval = KMessageBox::warningContinueCancel(0,
i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel"));
if ( retval != KMessageBox::Continue )
return false;
}
}
qApp->processEvents();
return true;
}
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp
index 21aa0a4..f05b91b 100644
--- a/microkde/kapplication.cpp
+++ b/microkde/kapplication.cpp
@@ -40,71 +40,72 @@ int KApplication::execDialog( QDialog* d )
else
;//d->resize( 800, 600 );
return d->exec();
}
void KApplication::showLicence()
{
KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/licence.txt" );
}
void KApplication::showFile(QString caption, QString fn)
{
QString text;
QString fileName;
#ifndef DESKTOP_VERSION
fileName = getenv("QPEDIR");
fileName += "/pics/" + fn ;
#else
fileName = qApp->applicationDirPath () + "/" + fn;
#endif
QFile file( fileName );
if (!file.open( IO_ReadOnly ) ) {
return ;
}
QTextStream ts( &file );
text = ts.read();
file.close();
KApplication::showText( caption, text );
}
bool KApplication::convert2latin1(QString fileName)
{
QString text;
QFile file( fileName );
if (!file.open( IO_ReadOnly ) ) {
return false;
}
QTextStream ts( &file );
ts.setEncoding( QTextStream::UnicodeUTF8 );
text = ts.read();
file.close();
if (!file.open( IO_WriteOnly ) ) {
return false;
}
QTextStream tsIn( &file );
tsIn.setEncoding( QTextStream::Latin1 );
tsIn << text.latin1();
- file.close();
+ file.close();
+ return true;
}
void KApplication::showText(QString caption, QString text)
{
QDialog dia( 0, "name", true ); ;
dia.setCaption( caption );
QVBoxLayout* lay = new QVBoxLayout( &dia );
lay->setSpacing( 3 );
lay->setMargin( 3 );
KTextEdit tb ( &dia );
tb.setWordWrap( QMultiLineEdit::WidgetWidth );
lay->addWidget( &tb );
tb.setText( text );
#ifdef DESKTOP_VERSION
dia.resize( 640, 480);
#else
dia.showMaximized();
#endif
dia.exec();
}
diff --git a/microkde/kdecore/klibloader.cpp b/microkde/kdecore/klibloader.cpp
index 1394154..6d0475a 100644
--- a/microkde/kdecore/klibloader.cpp
+++ b/microkde/kdecore/klibloader.cpp
@@ -451,107 +451,99 @@ int olt_dlopen_flag = lt_dlopen_flag;
/*US
lt_dlopen_flag = olt_dlopen_flag;
*/
return tmp;
}
KLibrary* KLibLoader::library( const char *name )
{
if (!name)
return 0;
KLibWrapPrivate* wrap = m_libs[name];
if (wrap) {
/* Nothing to do to load the library. */
wrap->ref_count++;
return wrap->lib;
}
/* Test if this library was loaded at some time, but got
unloaded meanwhile, whithout being dlclose()'ed. */
QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack);
for (; it.current(); ++it) {
if (it.current()->name == name)
wrap = it.current();
}
if (wrap) {
d->pending_close.removeRef(wrap);
if (!wrap->lib) {
/* This lib only was in loaded_stack, but not in m_libs. */
wrap->lib = new KLibrary( name, wrap->filename, wrap->handle );
}
wrap->ref_count++;
} else {
QString libfile = findLibrary( name );
if ( libfile.isEmpty() )
return 0;
#ifdef DESKTOP_VERSION
QLibrary *qlib = new QLibrary( libfile.latin1() );
#else
QLibrary *qlib = new QLibrary( libfile.latin1(), QLibrary::Immediately );
#endif
//US lt_dlhandle handle = lt_dlopen( libfile.latin1() );
//US if ( !handle )
if ( !qlib )
{
-//US const char* errmsg = lt_dlerror();
- char* errmsg;
- sprintf(errmsg, "KLibLoader::library could not load library: %s", libfile.latin1());
- qDebug(errmsg);
-
- if(errmsg)
- d->errorMessage = QString::fromLatin1(errmsg);
- else
- d->errorMessage = QString::null;
- kdWarning(150) << "library=" << name << ": file=" << libfile << ": " << d->errorMessage << endl;
- return 0;
+ qDebug( "KLibLoader::library could not load library: %s", libfile.latin1());
+ d->errorMessage = QString::null;
+ return 0;
}
else
d->errorMessage = QString::null;
KLibrary *lib = new KLibrary( name, libfile, qlib );
wrap = new KLibWrapPrivate(lib, qlib);
d->loaded_stack.prepend(wrap);
}
m_libs.insert( name, wrap );
connect( wrap->lib, SIGNAL( destroyed() ),
this, SLOT( slotLibraryDestroyed() ) );
return wrap->lib;
}
QString KLibLoader::lastErrorMessage() const
{
return d->errorMessage;
}
void KLibLoader::unloadLibrary( const char *libname )
{
KLibWrapPrivate *wrap = m_libs[ libname ];
if (!wrap)
return;
if (--wrap->ref_count)
return;
// kdDebug(150) << "closing library " << libname << endl;
m_libs.remove( libname );
disconnect( wrap->lib, SIGNAL( destroyed() ),
this, SLOT( slotLibraryDestroyed() ) );
close_pending( wrap );
}
KLibFactory* KLibLoader::factory( const char* name )
{
KLibrary* lib = library( name );
if ( !lib )
return 0;
return lib->factory();
}
void KLibLoader::slotLibraryDestroyed()
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index 1ad1728..09ad0c8 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -833,97 +833,97 @@ void KToolBar::hideItem (int id)
w->hide();
}
void KToolBar::showItem (int id)
{
QWidget *w = getWidget(id);
if ( w )
w->show();
}
int KToolBar::itemIndex (int id)
{
QWidget *w = getWidget(id);
return w ? widgets.findRef(w) : -1;
}
void KToolBar::setFullSize(bool flag )
{
setHorizontalStretchable( flag );
setVerticalStretchable( flag );
}
bool KToolBar::fullSize() const
{
return isHorizontalStretchable() || isVerticalStretchable();
}
void KToolBar::enableMoving(bool flag )
{
//US setMovingEnabled(flag);
this->mainWindow()->setToolBarsMovable(flag);
}
void KToolBar::setBarPos (BarPosition bpos)
{
if ( !mainWindow() )
return;
//US mainWindow()->moveDockWindow( this, (Dock)bpos );
mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos );
}
-KToolBar::BarPosition KToolBar::barPos()
+KToolBar::BarPosition KToolBar::barPos() const
{
if ( !(QMainWindow*)mainWindow() )
return KToolBar::Top;
//US Dock dock;
QMainWindow::ToolBarDock dock;
int dm1, dm2;
bool dm3;
((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 );
//US if ( dock == DockUnmanaged ) {
if ( dock == QMainWindow::Unmanaged ) {
return (KToolBar::BarPosition)Top;
}
return (BarPosition)dock;
}
bool KToolBar::enable(BarStatus stat)
{
bool mystat = isVisible();
if ( (stat == Toggle && mystat) || stat == Hide )
hide();
else
show();
return isVisible() == mystat;
}
void KToolBar::setMaxHeight ( int h )
{
setMaximumHeight( h );
}
int KToolBar::maxHeight()
{
return maximumHeight();
}
void KToolBar::setMaxWidth (int dw)
{
setMaximumWidth( dw );
}
int KToolBar::maxWidth()
{
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h
index 61b5ea3..49ff856 100644
--- a/microkde/kdeui/ktoolbar.h
+++ b/microkde/kdeui/ktoolbar.h
@@ -701,97 +701,97 @@ public:
/**
* Show item.
*/
void showItem (int id);
/**
* Returns the index of the given item.
*
* KDE4: make this const!
*/
int itemIndex (int id);
/**
* Set toolbar to full parent size (default).
*
* In full size mode the bar
* extends over the parent's full width or height. If the mode is disabled
* the toolbar tries to take as much space as it needs without wrapping, but
* it does not exceed the parent box. You can force a certain width or
* height with @ref setMaxWidth() or @ref setMaxHeight().
*
* If you want to use right-aligned items or auto-sized items you must use
* full size mode.
*/
void setFullSize(bool flag = true);
/**
* @return @p true if the full-size mode is enabled. Otherwise
* it returns @false.
*/
bool fullSize() const;
/**
* @deprecated use setMovingEnabled(bool) instead.
* Enable or disable moving of toolbar.
*/
void enableMoving(bool flag = true);
/**
* Set position of toolbar.
* @see BarPosition()
*/
void setBarPos (BarPosition bpos);
/**
* Returns position of toolbar.
*/
- BarPosition barPos();
+ BarPosition barPos() const;
/**
* @deprecated
* Show, hide, or toggle toolbar.
*
* This method is provided for compatibility only,
* please use show() and/or hide() instead.
* @see BarStatus
*/
bool enable(BarStatus stat);
/**
* @deprecated
* Use setMaximumHeight() instead.
*/
void setMaxHeight (int h); // Set max height for vertical toolbars
/**
* @deprecated
* Use maximumHeight() instead.
* Returns the value that was set with @ref setMaxHeight().
*/
int maxHeight();
/**
* @deprecated
* Use setMaximumWidth() instead.
* Set maximal width of horizontal (top or bottom) toolbar.
*/
void setMaxWidth (int dw);
/**
* @deprecated
* Use maximumWidth() instead.
* Returns the value that was set with @ref setMaxWidth().
*/
int maxWidth();
/**
* Set title for toolbar when it floats.
*
* Titles are however not (yet)
* visible. You can't change toolbar's title while it's floating.
*/
void setTitle (const QString& _title);
/**
* @deprecated