summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp38
1 files changed, 35 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index ad1c0cd..2da592b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1614,117 +1614,149 @@ void MainWindow::importOL()
1614void MainWindow::importBday() 1614void MainWindow::importBday()
1615{ 1615{
1616 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1616 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1617 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1617 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1618 i18n("Import!"), i18n("Cancel"), 0, 1618 i18n("Import!"), i18n("Cancel"), 0,
1619 0, 1 ); 1619 0, 1 );
1620 if ( result == 0 ) { 1620 if ( result == 0 ) {
1621 mView->importBday(); 1621 mView->importBday();
1622 1622
1623 } 1623 }
1624 1624
1625 1625
1626} 1626}
1627void MainWindow::importQtopia() 1627void MainWindow::importQtopia()
1628{ 1628{
1629 //#ifndef DESKTOP_VERSION 1629 //#ifndef DESKTOP_VERSION
1630 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1630 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1631#ifdef DESKTOP_VERSION 1631#ifdef DESKTOP_VERSION
1632 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1632 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1633#endif 1633#endif
1634 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1634 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1635 i18n("Import!"), i18n("Cancel"), 0, 1635 i18n("Import!"), i18n("Cancel"), 0,
1636 0, 1 ); 1636 0, 1 );
1637 if ( result == 0 ) { 1637 if ( result == 0 ) {
1638#ifndef DESKTOP_VERSION 1638#ifndef DESKTOP_VERSION
1639 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1639 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1640 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1640 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1641 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1641 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1642#else 1642#else
1643 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1643 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1644 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1644 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1645 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1645 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1646#endif 1646#endif
1647 mView->importQtopia( categories, datebook, todolist ); 1647 mView->importQtopia( categories, datebook, todolist );
1648 } 1648 }
1649#if 0 1649#if 0
1650 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1650 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1651 i18n("Not supported \non desktop!\n"), 1651 i18n("Not supported \non desktop!\n"),
1652 i18n("Ok"), i18n("Cancel"), 0, 1652 i18n("Ok"), i18n("Cancel"), 0,
1653 0, 1 ); 1653 0, 1 );
1654 1654
1655#endif 1655#endif
1656} 1656}
1657 1657
1658void MainWindow::saveOnClose() 1658void MainWindow::saveOnClose()
1659{ 1659{
1660 KOPrefs *p = KOPrefs::instance(); 1660 KOPrefs *p = KOPrefs::instance();
1661 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1661 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1662 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1663 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1664 if ( filterToolBar ) {
1665 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1666 }
1667#ifdef DESKTOP_VERSION
1668
1669 QPoint myP;
1670 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1671 if ( p->mToolBarHor )
1672 p->mToolBarUp = myP.y() > height()/2;
1673 else
1674 p->mToolBarUp = myP.x() > width()/2;
1675 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1676 if ( p->mToolBarHorV )
1677 p->mToolBarUpV = myP.y() > height()/2;
1678 else
1679 p->mToolBarUpV = myP.x() > width()/2 ;
1680 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1681 if ( p->mToolBarHorN )
1682 p->mToolBarUpN = myP.y() > height()/2;
1683 else
1684 p->mToolBarUpN = myP.x() > width()/2 ;
1685 if ( filterToolBar ) {
1686 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1687 if ( p->mToolBarHorF )
1688 p->mToolBarUpF = myP.y() > height()/2;
1689 else
1690 p->mToolBarUpF = myP.x() > width()/2 ;
1691 }
1692#else
1662 if ( p->mToolBarHor ) 1693 if ( p->mToolBarHor )
1663 p->mToolBarUp = iconToolBar->y() > height()/2; 1694 p->mToolBarUp = iconToolBar->y() > height()/2;
1664 else 1695 else
1665 p->mToolBarUp = iconToolBar->x() > width()/2; 1696 p->mToolBarUp = iconToolBar->x() > width()/2;
1666 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1667 if ( p->mToolBarHorV ) 1697 if ( p->mToolBarHorV )
1668 p->mToolBarUpV = viewToolBar->y() > height()/2; 1698 p->mToolBarUpV = viewToolBar->y() > height()/2;
1669 else 1699 else
1670 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1700 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1671 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1701
1672 if ( p->mToolBarHorN ) 1702 if ( p->mToolBarHorN )
1673 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1703 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1674 else 1704 else
1675 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1705 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1676 if ( filterToolBar ) { 1706 if ( filterToolBar ) {
1677 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1678 if ( p->mToolBarHorF ) 1707 if ( p->mToolBarHorF )
1679 p->mToolBarUpF = filterToolBar->y() > height()/2; 1708 p->mToolBarUpF = filterToolBar->y() > height()/2;
1680 else 1709 else
1681 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1710 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1682 } 1711 }
1712#endif
1713
1714
1683 mView->writeSettings(); 1715 mView->writeSettings();
1684 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1716 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1685 save(); 1717 save();
1686} 1718}
1687void MainWindow::slotModifiedChanged( bool changed ) 1719void MainWindow::slotModifiedChanged( bool changed )
1688{ 1720{
1689 if ( mBlockAtStartup ) 1721 if ( mBlockAtStartup )
1690 return; 1722 return;
1691 1723
1692 int msec; 1724 int msec;
1693 // we store the changes after 1 minute, 1725 // we store the changes after 1 minute,
1694 // and for safety reasons after 10 minutes again 1726 // and for safety reasons after 10 minutes again
1695 if ( !mSyncManager->blockSave() ) 1727 if ( !mSyncManager->blockSave() )
1696 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1728 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1697 else 1729 else
1698 msec = 1000 * 600; 1730 msec = 1000 * 600;
1699 mSaveTimer.start( msec, true ); // 1 minute 1731 mSaveTimer.start( msec, true ); // 1 minute
1700 qDebug("KO: Saving File in %d secs!", msec/1000); 1732 qDebug("KO: Saving File in %d secs!", msec/1000);
1701 mCalendarModifiedFlag = true; 1733 mCalendarModifiedFlag = true;
1702} 1734}
1703void MainWindow::saveStopTimer() 1735void MainWindow::saveStopTimer()
1704{ 1736{
1705 mSaveTimer.stop(); 1737 mSaveTimer.stop();
1706 if (mSaveTimer.isActive() ) 1738 if (mSaveTimer.isActive() )
1707 qDebug("ti active "); 1739 qDebug("ti active ");
1708 else 1740 else
1709 qDebug("KO: Save timer stopped"); 1741 qDebug("KO: Save timer stopped");
1710} 1742}
1711void MainWindow::save() 1743void MainWindow::save()
1712{ 1744{
1713 if ( !mCalendarModifiedFlag ) { 1745 if ( !mCalendarModifiedFlag ) {
1714 qDebug("KO: Calendar not modified. Nothing saved."); 1746 qDebug("KO: Calendar not modified. Nothing saved.");
1715 return; 1747 return;
1716 } 1748 }
1717 if ( mSyncManager->blockSave() ) 1749 if ( mSyncManager->blockSave() )
1718 return; 1750 return;
1719 mSyncManager->setBlockSave(true); 1751 mSyncManager->setBlockSave(true);
1720 if ( mView->checkFileVersion( defaultFileName()) ) { 1752 if ( mView->checkFileVersion( defaultFileName()) ) {
1721 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1753 QTime neededSaveTime = QDateTime::currentDateTime().time();
1722 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1754 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1723 qDebug("KO: Start saving data to file!"); 1755 qDebug("KO: Start saving data to file!");
1724 mView->saveCalendar( defaultFileName() ); 1756 mView->saveCalendar( defaultFileName() );
1725 mCalendarModifiedFlag = false; 1757 mCalendarModifiedFlag = false;
1726 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1758 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1727 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1759 qDebug("KO: Needed %d ms for saving.",msNeeded );
1728 QString savemes; 1760 QString savemes;
1729 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1761 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1730 setCaption(savemes); 1762 setCaption(savemes);