Index: kopete/plugins/history/historylogger.cpp =================================================================== --- kopete/plugins/history/historylogger.cpp (revision 890701) +++ kopete/plugins/history/historylogger.cpp (working copy) @@ -117,16 +117,16 @@ } -QDomDocument HistoryLogger::getDocument(const Kopete::Contact *c, unsigned int month , bool canLoad , bool* contain) +QDomDocument HistoryLogger::getDocument(const Kopete::Contact *c, unsigned int month , const QDate date , bool canLoad , bool* contain) { - if(m_realMonth!=QDate::currentDate().month()) + if(m_realMonth!=date.month() /*QDate::currentDate().month()*/) { //We changed month, our index is not correct anymore, clean memory. // or we will see what i called "the 31 midnight bug"(TM) :-) -Olivier m_documents.clear(); m_cachedMonth=-1; m_currentMonth++; //Not usre it's ok, but should work; m_oldMonth++; // idem - m_realMonth=QDate::currentDate().month(); + m_realMonth=date.month();//QDate::currentDate().month(); } if(!m_metaContact) @@ -149,7 +149,7 @@ return documents[month]; - QDomDocument doc = getDocument(c, QDate::currentDate().addMonths(0-month), canLoad, contain); + QDomDocument doc = getDocument(c, date.addMonths(0-month) /*QDate::currentDate().addMonths(0-month)*/, canLoad, contain); documents.insert(month, doc); m_documents[c]=documents; @@ -255,7 +255,9 @@ return; } - QDomDocument doc=getDocument(c,0); + + + QDomDocument doc=getDocument(c, 0, msg.timestamp().date()); QDomElement docElem = doc.documentElement(); if(docElem.isNull()) @@ -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, msg.timestamp().date()); if(!m_toSaveFileName.isEmpty() && m_toSaveFileName != filename) { //that mean the contact or the month has changed, save it now. saveToDisk(); Index: kopete/plugins/history/historylogger.h =================================================================== --- kopete/plugins/history/historylogger.h (revision 890701) +++ kopete/plugins/history/historylogger.h (working copy) @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -148,7 +149,7 @@ * Get the document, open it is @param canload is true, contain is set to false if the document * is not already contained */ - QDomDocument getDocument(const Kopete::Contact *c, unsigned int month , bool canLoad=true , bool* contain=0L); + QDomDocument getDocument(const Kopete::Contact *c, unsigned int month , const QDate date = QDate::currentDate(), bool canLoad=true , bool* contain=0L); QDomDocument getDocument(const Kopete::Contact *c, const QDate date, bool canLoad=true, bool* contain=0L); Index: kopete/plugins/history/historypreferences.cpp =================================================================== --- kopete/plugins/history/historypreferences.cpp (revision 890701) +++ kopete/plugins/history/historypreferences.cpp (working copy) @@ -19,6 +19,7 @@ #include "historypreferences.h" #include "historyconfig.h" #include "ui_historyprefsui.h" +#include "historyimport.h" #include @@ -51,6 +52,7 @@ this, SLOT(slotModified())); connect(p->History_color, SIGNAL(changed(const QColor&)), this, SLOT(slotModified())); + connect(p->importLogs, SIGNAL(clicked(void)), this, SLOT(importLogs(void))); } HistoryPreferences::~HistoryPreferences() @@ -94,4 +96,10 @@ emit KCModule::changed(true); } +void HistoryPreferences::importLogs(void) +{ + HistoryImport importer(this); + importer.exec(); +} + #include "historypreferences.moc" Index: kopete/plugins/history/historypreferences.h =================================================================== --- kopete/plugins/history/historypreferences.h (revision 890701) +++ kopete/plugins/history/historypreferences.h (working copy) @@ -42,6 +42,7 @@ private slots: void slotModified(); void slotShowPreviousChanged(bool); + void importLogs(void); private: Ui::HistoryPrefsUI *p; Index: kopete/plugins/history/historyprefsui.ui =================================================================== --- kopete/plugins/history/historyprefsui.ui (revision 890701) +++ kopete/plugins/history/historyprefsui.ui (working copy) @@ -14,42 +14,21 @@ 6 - + 0 - - 0 - - - 0 - - - 0 - Chat History - + 9 - - 9 - - - 9 - - - 9 - - + 6 - - 6 - @@ -58,7 +37,7 @@ QSizePolicy::Fixed - + 16 20 @@ -164,6 +143,13 @@ + + + + Import History + + + @@ -175,7 +161,7 @@ QSizePolicy::Expanding - + 341 16 Index: kopete/plugins/history/CMakeLists.txt =================================================================== --- kopete/plugins/history/CMakeLists.txt (revision 890701) +++ kopete/plugins/history/CMakeLists.txt (working copy) @@ -28,7 +28,7 @@ ########### next target ############### -set(kcm_kopete_history_PART_SRCS historypreferences.cpp ) +set(kcm_kopete_history_PART_SRCS historypreferences.cpp historyimport.cpp historylogger.cpp ) kde4_add_ui_files(kcm_kopete_history_PART_SRCS historyprefsui.ui )