Index: historylogger.cpp =================================================================== --- historylogger.cpp (revision 900154) +++ historylogger.cpp (working copy) @@ -255,7 +255,9 @@ return; } - QDomDocument doc=getDocument(c,0); + QDate date = msg.timestamp().date(); + + QDomDocument doc=getDocument(c, QDate::currentDate().month() - date.month() - (QDate::currentDate().year() - date.year()) * 12); QDomElement docElem = doc.documentElement(); if(docElem.isNull()) @@ -266,8 +268,8 @@ QDomElement headElem = doc.createElement( "head" ); docElem.appendChild( headElem ); QDomElement dateElem = doc.createElement( "date" ); - dateElem.setAttribute( "year", QString::number(QDate::currentDate().year()) ); - dateElem.setAttribute( "month", QString::number(QDate::currentDate().month()) ); + dateElem.setAttribute( "year", QString::number(date.year()) ); + dateElem.setAttribute( "month", QString::number(date.month()) ); headElem.appendChild(dateElem); QDomElement myselfElem = doc.createElement( "contact" ); myselfElem.setAttribute( "type", "myself" ); @@ -293,7 +295,7 @@ // On hight-traffic channel, saving can take lots of CPU. (because the file is big) // So i wait a time proportional to the time needed to save.. - const QString filename=getFileName(c,QDate::currentDate()); + const QString filename=getFileName(c, date); if(!m_toSaveFileName.isEmpty() && m_toSaveFileName != filename) { //that mean the contact or the month has changed, save it now. saveToDisk(); Index: historyviewer.ui =================================================================== --- historyviewer.ui (revision 900154) +++ historyviewer.ui (working copy) @@ -57,6 +57,13 @@ + + + Import History + + + + Message Filter: @@ -73,7 +80,7 @@ - 200 + 140 0 Index: historydialog.cpp =================================================================== --- historydialog.cpp (revision 900154) +++ historydialog.cpp (working copy) @@ -18,6 +18,7 @@ #include "historydialog.h" #include "historylogger.h" +#include "historyimport.h" #include "ui_historyviewer.h" #include "kopetemetacontact.h" #include "kopeteprotocol.h" @@ -161,6 +162,7 @@ connect(mMainWidget->searchLine, SIGNAL(textChanged(const QString&)), this, SLOT(slotSearchTextChanged(const QString&))); connect(mMainWidget->contactComboBox, SIGNAL(activated(int)), this, SLOT(slotContactChanged(int))); connect(mMainWidget->messageFilterBox, SIGNAL(activated(int)), this, SLOT(slotFilterChanged(int ))); + connect(mMainWidget->importHistory, SIGNAL(clicked()), this, SLOT(slotImportHistory())); connect(mHtmlPart, SIGNAL(popupMenu(const QString &, const QPoint &)), this, SLOT(slotRightClick(const QString &, const QPoint &))); //initActions @@ -614,4 +616,10 @@ connect( QApplication::clipboard(), SIGNAL( selectionChanged()), mHtmlPart, SLOT(slotClearSelection())); } +void HistoryDialog::slotImportHistory(void) +{ + HistoryImport importer(this); + importer.exec(); +} + #include "historydialog.moc" Index: historydialog.h =================================================================== --- historydialog.h (revision 900154) +++ historydialog.h (working copy) @@ -96,6 +96,8 @@ void slotCopy(); void slotCopyURL(); + void slotImportHistory(); + private: enum Disabled { Prev=1, Next=2 }; void refreshEnabled( /*Disabled*/ uint disabled ); Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (revision 900154) +++ CMakeLists.txt (working copy) @@ -11,7 +11,8 @@ historydialog.cpp historylogger.cpp converter.cpp - historyguiclient.cpp ) + historyguiclient.cpp + historyimport.cpp ) kde4_add_ui_files(kopete_history_PART_SRCS historyviewer.ui )