-rw-r--r-- | korganizer/calprintbase.cpp | 20 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 2 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 2 |
3 files changed, 9 insertions, 15 deletions
diff --git a/korganizer/calprintbase.cpp b/korganizer/calprintbase.cpp index f66fddc..7b7d54c 100644 --- a/korganizer/calprintbase.cpp +++ b/korganizer/calprintbase.cpp | |||
@@ -607,130 +607,124 @@ void CalPrintBase::drawAgendaItem( PrintCellItem *item, QPainter &p, | |||
607 | 607 | ||
608 | // set the colors according to the categories | 608 | // set the colors according to the categories |
609 | if ( mUseColors ) setCategoryColors( p, event ); | 609 | if ( mUseColors ) setCategoryColors( p, event ); |
610 | else p.setBrush( Qt::white ); | 610 | else p.setBrush( Qt::white ); |
611 | // start/end of print area for event | 611 | // start/end of print area for event |
612 | QDateTime startTime = event->dtStart(); | 612 | QDateTime startTime = event->dtStart(); |
613 | QDateTime endTime = event->dtEnd(); | 613 | QDateTime endTime = event->dtEnd(); |
614 | if ( event->doesRecur() ) { | 614 | if ( event->doesRecur() ) { |
615 | startTime.setDate( qd ); | 615 | startTime.setDate( qd ); |
616 | endTime.setDate( qd ); | 616 | endTime.setDate( qd ); |
617 | } | 617 | } |
618 | if ( ( startTime < endPrintDate && endTime > startPrintDate ) || | 618 | if ( ( startTime < endPrintDate && endTime > startPrintDate ) || |
619 | ( endTime > startPrintDate && startTime < endPrintDate ) ) { | 619 | ( endTime > startPrintDate && startTime < endPrintDate ) ) { |
620 | if ( startTime < startPrintDate ) startTime = startPrintDate; | 620 | if ( startTime < startPrintDate ) startTime = startPrintDate; |
621 | if ( endTime > endPrintDate ) endTime = endPrintDate; | 621 | if ( endTime > endPrintDate ) endTime = endPrintDate; |
622 | int eventLength = int( startTime.secsTo( endTime ) / 60. * minlen ); | 622 | int eventLength = int( startTime.secsTo( endTime ) / 60. * minlen ); |
623 | int currentyPos = int( y + startPrintDate.secsTo( startTime ) * | 623 | int currentyPos = int( y + startPrintDate.secsTo( startTime ) * |
624 | minlen / 60. ); | 624 | minlen / 60. ); |
625 | int currentWidth = width / item->subCells(); | 625 | int currentWidth = width / item->subCells(); |
626 | int currentX = x + item->subCell() * currentWidth; | 626 | int currentX = x + item->subCell() * currentWidth; |
627 | QString text = KGlobal::locale()->formatTime(event->dtStart().time())+ | 627 | QString text = KGlobal::locale()->formatTime(event->dtStart().time())+ |
628 | "-"+KGlobal::locale()->formatTime(event->dtEnd().time())+ | 628 | "-"+KGlobal::locale()->formatTime(event->dtEnd().time())+ |
629 | " "+event->summary(); | 629 | " "+event->summary(); |
630 | if ( !event->location().isEmpty() ) | 630 | if ( !event->location().isEmpty() ) |
631 | text += " (" +event->location()+")"; | 631 | text += " (" +event->location()+")"; |
632 | // p.save(); | 632 | // p.save(); |
633 | QPen pe = p.pen(); | 633 | QPen pe = p.pen(); |
634 | pe.setWidth( 2 ); | 634 | pe.setWidth( 2 ); |
635 | p.setPen( pe ); | 635 | p.setPen( pe ); |
636 | p.drawRect( currentX, currentyPos+1, currentWidth+1, eventLength+1 ); | 636 | p.drawRect( currentX, currentyPos+1, currentWidth+1, eventLength+1 ); |
637 | p.drawText( currentX+3, currentyPos+2, currentWidth-5, eventLength-3, | 637 | p.drawText( currentX+3, currentyPos+2, currentWidth-5, eventLength-3, |
638 | AlignLeft | AlignTop | AlignJustify | WordBreak, | 638 | AlignLeft | AlignTop | AlignJustify | WordBreak, |
639 | text); | 639 | text); |
640 | // p.restore(); | 640 | // p.restore(); |
641 | } | 641 | } |
642 | } | 642 | } |
643 | 643 | ||
644 | void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, | 644 | void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd, |
645 | int x, int y, int width, int height, | 645 | int x, int y, int width, int height, |
646 | bool fullDate) | 646 | bool fullDate) |
647 | { | 647 | { |
648 | QString dayNumStr; | 648 | QString dayNumStr; |
649 | QString ampm; | 649 | QString ampm; |
650 | const KLocale*local = KGlobal::locale(); | 650 | const KLocale*local = KGlobal::locale(); |
651 | 651 | ||
652 | 652 | ||
653 | // This has to be localized | 653 | // This has to be localized |
654 | if (fullDate) { | 654 | if (fullDate) { |
655 | /*int index; | 655 | dayNumStr = local->formatDate(qd); |
656 | dayNumStr= qd.toString(); | ||
657 | index = dayNumStr.find(' '); | ||
658 | dayNumStr.remove(0, index); | ||
659 | index = dayNumStr.findRev(' '); | ||
660 | dayNumStr.truncate(index);*/ | ||
661 | |||
662 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); | ||
663 | dayNumStr = i18n("weekday month date", "%1 %2 %3") | ||
664 | .arg( calSys->weekDayName( qd ) ) | ||
665 | .arg( calSys->monthName( qd ) ) | ||
666 | .arg( qd.day() ); | ||
667 | // dayNumStr = local->formatDate(qd); | ||
668 | } else { | 656 | } else { |
669 | dayNumStr = QString::number( qd.day() ); | 657 | dayNumStr = QString::number( qd.day() ); |
670 | } | 658 | } |
671 | 659 | ||
672 | p.eraseRect( x, y, width, height ); | 660 | p.eraseRect( x, y, width, height ); |
673 | p.drawRect( x, y, width, height ); | 661 | p.drawRect( x, y, width, height ); |
674 | // p.fillRect( x+1, y+1, width-2,height, QBrush(Dense7Pattern) ); | 662 | // p.fillRect( x+1, y+1, width-2,height, QBrush(Dense7Pattern) ); |
675 | p.drawRect( x, y, width, mSubHeaderHeight ); | 663 | p.drawRect( x, y, width, mSubHeaderHeight ); |
676 | //p.fillRect( x+1, y+1, width-2, mSubHeaderHeight-2, QBrush(Dense7Pattern) ); | 664 | //p.fillRect( x+1, y+1, width-2, mSubHeaderHeight-2, QBrush(Dense7Pattern) ); |
677 | QString hstring; | 665 | QString hstring; |
678 | #ifndef KORG_NOPLUGINS | 666 | #ifndef KORG_NOPLUGINS |
679 | hstring=KOCore::self()->holiday(qd); | 667 | hstring=KOCore::self()->holiday(qd); |
680 | #endif | 668 | #endif |
681 | 669 | ||
682 | if (!hstring.isEmpty()) { | 670 | if (!hstring.isEmpty()) { |
683 | p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) ); | 671 | p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) ); |
684 | 672 | ||
685 | p.drawText( x+5, y, width-25, mSubHeaderHeight, AlignLeft | AlignVCenter, | 673 | p.drawText( x+5, y, width-25, mSubHeaderHeight, AlignLeft | AlignVCenter, |
686 | hstring ); | 674 | hstring ); |
687 | } | 675 | } |
688 | p.setFont(QFont("helvetica", 10, QFont::Bold)); | 676 | p.setFont(QFont("helvetica", 10, QFont::Bold)); |
677 | if ( fullDate) { | ||
678 | // use short date format, if long date is too long | ||
679 | QFontMetrics fm ( p.font() ); | ||
680 | if ( fm.width( dayNumStr ) > width -10 ) | ||
681 | dayNumStr = local->formatDate(qd, true); | ||
682 | } | ||
689 | p.drawText(x+5, y, width-10, mSubHeaderHeight, AlignRight | AlignVCenter, | 683 | p.drawText(x+5, y, width-10, mSubHeaderHeight, AlignRight | AlignVCenter, |
690 | dayNumStr); | 684 | dayNumStr); |
691 | Event::List eventList; | 685 | Event::List eventList; |
692 | eventList.fill( mCalendar->events( qd, true )); | 686 | eventList.fill( mCalendar->events( qd, true )); |
693 | Todo::List todos; | 687 | Todo::List todos; |
694 | todos.fill( mCalendar->todos( qd )); | 688 | todos.fill( mCalendar->todos( qd )); |
695 | QString outStr; | 689 | QString outStr; |
696 | p.setFont( QFont( "helvetica", 8 ) ); | 690 | p.setFont( QFont( "helvetica", 8 ) ); |
697 | int lineSpacing = p.fontMetrics().lineSpacing(); | 691 | int lineSpacing = p.fontMetrics().lineSpacing(); |
698 | 692 | ||
699 | int textY=mSubHeaderHeight+3; // gives the relative y-coord of the next printed entry | 693 | int textY=mSubHeaderHeight+3; // gives the relative y-coord of the next printed entry |
700 | Event::List::ConstIterator it; | 694 | Event::List::ConstIterator it; |
701 | int entryCount = eventList.count() +todos.count(); | 695 | int entryCount = eventList.count() +todos.count(); |
702 | if ( p.fontMetrics().lineSpacing()* entryCount > height-textY ) { | 696 | if ( p.fontMetrics().lineSpacing()* entryCount > height-textY ) { |
703 | if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) { | 697 | if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) { |
704 | p.setFont( QFont( "helvetica", 7 ) ); | 698 | p.setFont( QFont( "helvetica", 7 ) ); |
705 | if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) | 699 | if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) |
706 | p.setFont( QFont( "helvetica", 6 ) ); | 700 | p.setFont( QFont( "helvetica", 6 ) ); |
707 | } | 701 | } |
708 | lineSpacing = p.fontMetrics().lineSpacing()-1; | 702 | lineSpacing = p.fontMetrics().lineSpacing()-1; |
709 | } | 703 | } |
710 | // qDebug("fm %d %d %d ",p.fontMetrics().height(), eventList.count() , height-textY ); | 704 | // qDebug("fm %d %d %d ",p.fontMetrics().height(), eventList.count() , height-textY ); |
711 | for( it = eventList.begin(); it != eventList.end() && textY<height; ++it ) { | 705 | for( it = eventList.begin(); it != eventList.end() && textY<height; ++it ) { |
712 | Event *currEvent = *it; | 706 | Event *currEvent = *it; |
713 | if (currEvent->doesFloat() || currEvent->isMultiDay()) | 707 | if (currEvent->doesFloat() || currEvent->isMultiDay()) |
714 | outStr = currEvent->summary(); | 708 | outStr = currEvent->summary(); |
715 | 709 | ||
716 | else { | 710 | else { |
717 | if ( fullDate ) { | 711 | if ( fullDate ) { |
718 | outStr = KGlobal::locale()->formatTime( currEvent->dtStart().time())+ | 712 | outStr = KGlobal::locale()->formatTime( currEvent->dtStart().time())+ |
719 | "-"+KGlobal::locale()->formatTime( currEvent->dtEnd().time())+ | 713 | "-"+KGlobal::locale()->formatTime( currEvent->dtEnd().time())+ |
720 | " "+ currEvent->summary(); | 714 | " "+ currEvent->summary(); |
721 | if ( ! currEvent->location().isEmpty() ) | 715 | if ( ! currEvent->location().isEmpty() ) |
722 | outStr += " (" + currEvent->location()+")"; | 716 | outStr += " (" + currEvent->location()+")"; |
723 | } else { | 717 | } else { |
724 | QTime t1 = currEvent->dtStart().time(); | 718 | QTime t1 = currEvent->dtStart().time(); |
725 | 719 | ||
726 | outStr = local->formatTime(t1); | 720 | outStr = local->formatTime(t1); |
727 | outStr += " " + currEvent->summary(); | 721 | outStr += " " + currEvent->summary(); |
728 | } | 722 | } |
729 | 723 | ||
730 | } // doesFloat | 724 | } // doesFloat |
731 | 725 | ||
732 | p.drawText(x+5, y+textY, width-10, lineSpacing, | 726 | p.drawText(x+5, y+textY, width-10, lineSpacing, |
733 | AlignLeft|AlignBottom, outStr); | 727 | AlignLeft|AlignBottom, outStr); |
734 | textY+=lineSpacing; | 728 | textY+=lineSpacing; |
735 | } | 729 | } |
736 | 730 | ||
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index e8b7c94..8c2996b 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1959,97 +1959,97 @@ void KOAgenda::restorePosition() | |||
1959 | if ( mContentPosition == 0 ) | 1959 | if ( mContentPosition == 0 ) |
1960 | posY = 0; | 1960 | posY = 0; |
1961 | else | 1961 | else |
1962 | posY = (max/mContentPosition)-(viewport()->height()/2); | 1962 | posY = (max/mContentPosition)-(viewport()->height()/2); |
1963 | setContentsPos (0, posY ); | 1963 | setContentsPos (0, posY ); |
1964 | //qDebug("posY %d hei %d", posY, max); | 1964 | //qDebug("posY %d hei %d", posY, max); |
1965 | 1965 | ||
1966 | } | 1966 | } |
1967 | void KOAgenda::moveChild( QWidget *w, int x , int y ) | 1967 | void KOAgenda::moveChild( QWidget *w, int x , int y ) |
1968 | { | 1968 | { |
1969 | ++x; | 1969 | ++x; |
1970 | QScrollView::moveChild( w, x , y ); | 1970 | QScrollView::moveChild( w, x , y ); |
1971 | } | 1971 | } |
1972 | #include <qmessagebox.h> | 1972 | #include <qmessagebox.h> |
1973 | #ifdef DESKTOP_VERSION | 1973 | #ifdef DESKTOP_VERSION |
1974 | #include <qprinter.h> | 1974 | #include <qprinter.h> |
1975 | #include <qpainter.h> | 1975 | #include <qpainter.h> |
1976 | #include <qpaintdevicemetrics.h> | 1976 | #include <qpaintdevicemetrics.h> |
1977 | 1977 | ||
1978 | #endif | 1978 | #endif |
1979 | void KOAgenda::printSelection() | 1979 | void KOAgenda::printSelection() |
1980 | { | 1980 | { |
1981 | #ifdef DESKTOP_VERSION | 1981 | #ifdef DESKTOP_VERSION |
1982 | if ( mStartCellY == mCurrentCellY ) { | 1982 | if ( mStartCellY == mCurrentCellY ) { |
1983 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1983 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1984 | i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "), | 1984 | i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "), |
1985 | i18n("OK"), 0, 0, | 1985 | i18n("OK"), 0, 0, |
1986 | 0, 1 ); | 1986 | 0, 1 ); |
1987 | return; | 1987 | return; |
1988 | } | 1988 | } |
1989 | 1989 | ||
1990 | float dx, dy; | 1990 | float dx, dy; |
1991 | int x,y,w,h; | 1991 | int x,y,w,h; |
1992 | x= 0; | 1992 | x= 0; |
1993 | w= contentsWidth()+2; | 1993 | w= contentsWidth()+2; |
1994 | // h= contentsHeight(); | 1994 | // h= contentsHeight(); |
1995 | y = mGridSpacingY*mStartCellY; | 1995 | y = mGridSpacingY*mStartCellY; |
1996 | h = mGridSpacingY*(mCurrentCellY+1)-y+2; | 1996 | h = mGridSpacingY*(mCurrentCellY+1)-y+2; |
1997 | 1997 | ||
1998 | //return; | 1998 | //return; |
1999 | QPrinter* printer = new QPrinter(); | 1999 | QPrinter* printer = new QPrinter(); |
2000 | if ( !printer->setup()) { | 2000 | if ( !printer->setup()) { |
2001 | delete printer; | 2001 | delete printer; |
2002 | return; | 2002 | return; |
2003 | } | 2003 | } |
2004 | QPainter p( printer ); | 2004 | QPainter p( printer ); |
2005 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); | 2005 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); |
2006 | QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); | 2006 | QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); |
2007 | date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); | 2007 | //date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); |
2008 | int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); | 2008 | int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); |
2009 | // p.drawText( 0, 0, date ); | 2009 | // p.drawText( 0, 0, date ); |
2010 | int offset = m.width()/8; | 2010 | int offset = m.width()/8; |
2011 | // compute the scale | 2011 | // compute the scale |
2012 | dx = ((float) m.width()-offset) / (float)w; | 2012 | dx = ((float) m.width()-offset) / (float)w; |
2013 | dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; | 2013 | dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; |
2014 | float scale; | 2014 | float scale; |
2015 | // scale to fit the width or height of the paper | 2015 | // scale to fit the width or height of the paper |
2016 | if ( dx < dy ) | 2016 | if ( dx < dy ) |
2017 | scale = dx; | 2017 | scale = dx; |
2018 | else | 2018 | else |
2019 | scale = dy; | 2019 | scale = dy; |
2020 | // set the scale | 2020 | // set the scale |
2021 | p.drawText( offset* scale, offset* scale*3/4, date ); | 2021 | p.drawText( offset* scale, offset* scale*3/4, date ); |
2022 | 2022 | ||
2023 | int selDay; | 2023 | int selDay; |
2024 | float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count())); | 2024 | float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count())); |
2025 | float startX = 1; | 2025 | float startX = 1; |
2026 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) | 2026 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) |
2027 | { | 2027 | { |
2028 | QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true ); | 2028 | QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true ); |
2029 | p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) ); | 2029 | p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) ); |
2030 | p.drawText( offset* scale+startX, (offset+hei)* scale, text ); | 2030 | p.drawText( offset* scale+startX, (offset+hei)* scale, text ); |
2031 | startX += widOffset; | 2031 | startX += widOffset; |
2032 | 2032 | ||
2033 | } | 2033 | } |
2034 | p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale)); | 2034 | p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale)); |
2035 | p.scale( scale, scale ); | 2035 | p.scale( scale, scale ); |
2036 | p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale ); | 2036 | p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale ); |
2037 | // now printing with y offset: 2 hei | 2037 | // now printing with y offset: 2 hei |
2038 | // p.translate( 0, -y*scale); | 2038 | // p.translate( 0, -y*scale); |
2039 | 2039 | ||
2040 | drawContentsToPainter(&p, true ); | 2040 | drawContentsToPainter(&p, true ); |
2041 | globalFlagBlockAgendaItemUpdate = false; | 2041 | globalFlagBlockAgendaItemUpdate = false; |
2042 | KOAgendaItem *item; | 2042 | KOAgendaItem *item; |
2043 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 2043 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
2044 | item->select(false); | 2044 | item->select(false); |
2045 | item->paintMe( false, &p ); | 2045 | item->paintMe( false, &p ); |
2046 | } | 2046 | } |
2047 | globalFlagBlockAgendaItemUpdate = true; | 2047 | globalFlagBlockAgendaItemUpdate = true; |
2048 | p.end(); | 2048 | p.end(); |
2049 | delete printer; | 2049 | delete printer; |
2050 | #else | 2050 | #else |
2051 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2051 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2052 | i18n("Not supported \non PDA!\n"), | 2052 | i18n("Not supported \non PDA!\n"), |
2053 | i18n("OK"), 0, 0, | 2053 | i18n("OK"), 0, 0, |
2054 | 0, 1 ); | 2054 | 0, 1 ); |
2055 | #endif | 2055 | #endif |
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index ac7d205..a09b278 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp | |||
@@ -12,97 +12,97 @@ | |||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <kglobalsettings.h> | 35 | #include <kglobalsettings.h> |
36 | #include <kstaticdeleter.h> | 36 | #include <kstaticdeleter.h> |
37 | 37 | ||
38 | #include <qregexp.h> | 38 | #include <qregexp.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <stdlib.h> | 40 | #include <stdlib.h> |
41 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
42 | #include <qapplication.h> | 42 | #include <qapplication.h> |
43 | #include "kpimglobalprefs.h" | 43 | #include "kpimglobalprefs.h" |
44 | 44 | ||
45 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; | 45 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; |
46 | static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; | 46 | static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; |
47 | 47 | ||
48 | 48 | ||
49 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) | 49 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) |
50 | : KPrefs("microkdeglobalrc") | 50 | : KPrefs("microkdeglobalrc") |
51 | { | 51 | { |
52 | mLocaleDict = 0; | 52 | mLocaleDict = 0; |
53 | KPrefs::setCurrentGroup("Fonts"); | 53 | KPrefs::setCurrentGroup("Fonts"); |
54 | addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() ); | 54 | addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() ); |
55 | KPrefs::setCurrentGroup("Locale"); | 55 | KPrefs::setCurrentGroup("Locale"); |
56 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 56 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
57 | addItemInt("PreferredTime",&mPreferredTime,0); | 57 | addItemInt("PreferredTime",&mPreferredTime,0); |
58 | addItemInt("PreferredDate",&mPreferredDate,0); | 58 | addItemInt("PreferredDate",&mPreferredDate,0); |
59 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | 59 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); |
60 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | 60 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%AK %d. %b %y"); |
61 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | 61 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); |
62 | 62 | ||
63 | KPrefs::setCurrentGroup("Time & Date"); | 63 | KPrefs::setCurrentGroup("Time & Date"); |
64 | 64 | ||
65 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); | 65 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); |
66 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | 66 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); |
67 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); | 67 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); |
68 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | 68 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); |
69 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | 69 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); |
70 | 70 | ||
71 | KPrefs::setCurrentGroup( "ExternalApplications" ); | 71 | KPrefs::setCurrentGroup( "ExternalApplications" ); |
72 | 72 | ||
73 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); | 73 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); |
74 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); | 74 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); |
75 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); | 75 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); |
76 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); | 76 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); |
77 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); | 77 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); |
78 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); | 78 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); |
79 | 79 | ||
80 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); | 80 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); |
81 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); | 81 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); |
82 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); | 82 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); |
83 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); | 83 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); |
84 | 84 | ||
85 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); | 85 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); |
86 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); | 86 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); |
87 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); | 87 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); |
88 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); | 88 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); |
89 | 89 | ||
90 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); | 90 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); |
91 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); | 91 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); |
92 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); | 92 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); |
93 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); | 93 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); |
94 | 94 | ||
95 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); | 95 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); |
96 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); | 96 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); |
97 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); | 97 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); |
98 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); | 98 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); |
99 | 99 | ||
100 | addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); | 100 | addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); |
101 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); | 101 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); |
102 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); | 102 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); |
103 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); | 103 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); |
104 | 104 | ||
105 | KPrefs::setCurrentGroup( "PhoneAccess" ); | 105 | KPrefs::setCurrentGroup( "PhoneAccess" ); |
106 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); | 106 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); |
107 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); | 107 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); |
108 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); | 108 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); |