From: Cuong Le Date: Wed, 28 Sep 2011 06:45:49 +0000 (+0700) Subject: first commits to develop X-Git-Url: http://vcs.maemo.org/git/?p=vncallhistory;a=commitdiff_plain;h=d3283a1a0967680f2c179332764e1bcacd3d8f00 first commits to develop --- diff --git a/Contributors.txt b/Contributors.txt new file mode 100644 index 0000000..381a473 --- /dev/null +++ b/Contributors.txt @@ -0,0 +1,2 @@ +Cuong Le + - project owner/developer diff --git a/Licence.txt b/Licence.txt new file mode 100644 index 0000000..4f3d3e8 --- /dev/null +++ b/Licence.txt @@ -0,0 +1,278 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. diff --git a/deployment.pri b/deployment.pri new file mode 100644 index 0000000..46ea95e --- /dev/null +++ b/deployment.pri @@ -0,0 +1,115 @@ +# checksum 0x9840 version 0x40002 +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + isEmpty(ICON):exists($${TARGET}.svg):ICON = $${TARGET}.svg + isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 +} else:win32 { + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, /, \\) + sourcePathSegments = $$split(source, \\) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments) + target = $$replace(target, /, \\) + !isEqual(source,$$target) { + !isEmpty(copyCommand):copyCommand += && + isEqual(QMAKE_DIR_SEP, \\) { + copyCommand += $(COPY_DIR) \"$$source\" \"$$target\" + } else { + source = $$replace(source, \\\\, /) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + target = $$replace(target, \\\\, /) + copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\" + } + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + desktopfile.path = /usr/share/applications/hildon + } else { + desktopfile.path = /usr/share/applications + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, \\\\, /) + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + target = $$replace(target, \\\\, /) + sourcePathSegments = $$split(source, /) + targetFullPath = $$target/$$last(sourcePathSegments) + !isEqual(source,$$targetFullPath) { + !isEmpty(copyCommand):copyCommand += && + copyCommand += $(MKDIR) \"$$target\" + copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\" + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + installPrefix = /opt/$${TARGET} + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + icon.files = $${TARGET}.png + icon.path = /usr/share/icons/hicolor/64x64/apps + desktopfile.files = $${TARGET}.desktop + target.path = $${installPrefix}/bin + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + export(target.path) + INSTALLS += desktopfile icon target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/elv1db.cc b/elv1db.cc new file mode 100644 index 0000000..9f5f4da --- /dev/null +++ b/elv1db.cc @@ -0,0 +1,131 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include "elv1db.h" + +#include +#include + +#include +#include + +#include + +elv1db::elv1db(QObject *parent): + QThread(parent), + m_type_query(0), + m_db(QSqlDatabase::addDatabase("QSQLITE")) +{ + m_db.setDatabaseName("/home/user/.rtcom-eventlogger/el-v1.db"); + m_db.open(); +} + +elv1db::~elv1db(){ + if (m_db.isOpen()) + m_db.close(); +} + +PhoneType elv1db::phonetype(QString metastr){ + if (metastr.contains("ring/tel/ring")) + return GSM_NETWORK; + else if (metastr.contains("spirit/skype")) + return SKYPE; + else if (metastr.contains("gabble/jabber") && metastr.contains("40gmail_2ecom0")) + return GOOGLE_TALK; + else if (metastr.contains("gabble/jabber")) + return JABBER; + return UNKNOW; +} + +QString elv1db::calltype(){ + return this->m_call_type==ALL_CALL?"and (event_type_id = 1 or event_type_id = 3)": + this->m_call_type==INCOMING?"and event_type_id = 1 and outgoing = 0": + this->m_call_type==OUTGOING?"and event_type_id = 1 and outgoing = 1":"and event_type_id = 3"; +} + +void elv1db::run(){ + if (this->m_type_query == 0) + emit start_indicator(); + else + emit detail_start_indicator(); + + sleep(1); + + if (this->m_type_query == 0){ + QString m_group_by_call(H_TOTAL_GROUP_BY); + setQuery(m_group_by_call + .arg(this->m_all_call?"":"and E.local_uid='ring/tel/ring'") + .arg(calltype())); + } + else{ + QString m_filter(" and remote_name = '%1' %2 "); + m_filter = m_filter.arg(m_contact_name).arg(calltype()); + QString m_default_search = QString(H_DEFAULT_SEARCH).arg(m_filter).arg(100); + setQuery(m_default_search); + } + + QSqlQuery *query = new QSqlQuery(this->m_query); + QSqlRecord record = query->record(); + if(record.count() > 0){ + if (this->m_type_query == 0){ + this->m_records.clear(); + while (query->next()) { + elv1rec *ef=new elv1rec(); + ef->set_contact_name(query->value(0).value()); + ef->set_total_call(query->value(1).value()); + this->m_records << ef; + } + }else{ + + this->m_detail_records.clear(); + + while (query->next()) { + elv1Detailrec *ef=new elv1Detailrec(); + + int calltype = query->value(0).value< int >(); + + if (calltype == 1 || calltype == 3){ + ef->set_phonenumber(query->value(5).value()); + ef->set_starttime(query->value(1).value()); + ef->set_endtime(query->value(2).value()); + if (query->value(2).value()) + ef->set_callduration(query->value(2).value() - query->value(1).value()); + else + ef->set_callduration(0); + if (calltype == 1) //call (outgoing/incoming) + ef->set_calltype(query->value(7).value()?OUTGOING:INCOMING); + else // call but missed + ef->set_calltype(MISSED); + + ef->set_phonetype( + this->phonetype(query->value(4).value()) + ); + + this->m_detail_records << ef; + } + + } + } + } + + delete query; + + if (this->m_type_query == 0) + emit group_by_finished(); + else + emit detail_finished(); +} diff --git a/elv1db.h b/elv1db.h new file mode 100644 index 0000000..d14466d --- /dev/null +++ b/elv1db.h @@ -0,0 +1,214 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#ifndef ELV1DB_H +#define ELV1DB_H + +#include +#include +#include +#include + +#define H_TOTAL_GROUP_BY "select remote_name, count(*) from Events E, Remotes R where R.remote_uid=E.remote_uid and E.local_uid=R.local_uid %1 %2 group by remote_name order by start_time desc" +#define H_DEFAULT_SEARCH "select event_type_id, start_time, end_time, is_read, E.local_uid, E.remote_uid, free_text, outgoing, remote_name from Events E, Remotes R where R.remote_uid=E.remote_uid and E.local_uid=R.local_uid %1 order by start_time desc limit %2" + +#define P_TYPE_GSM_NETWORK "ring/tel/ring" +#define P_TYPE_SKYPE "spirit/skype" +#define P_TYPE_JABBER "gabble/jabber" + +#define ICONS_ROOT_DIR "/usr/share/icons/hicolor/" + +#define IMG_AVATAR ICONS_ROOT_DIR "48x48/hildon/general_default_avatar.png" +#define IMG_OUTGOING ICONS_ROOT_DIR "48x48/hildon/general_sent.png" +#define IMG_INCOMING ICONS_ROOT_DIR "48x48/hildon/general_received.png" +#define IMG_MISSED ICONS_ROOT_DIR "48x48/hildon/general_missed.png" + +#define IMG_CELL ICONS_ROOT_DIR "32x32/hildon/call_status_cellular.png" +#define IMG_SKYPE ICONS_ROOT_DIR "32x32/hildon/general_skype.png" +#define IMG_GOOGLE ICONS_ROOT_DIR "32x32/hildon/general_gtalk.png" +#define IMG_SIP ICONS_ROOT_DIR "32x32/hildon/general_sip.png" +#define IMG_OVI ICONS_ROOT_DIR "32x32/hildon/general_ovi.png" +#define IMG_JABBER ICONS_ROOT_DIR "32x32/hildon/general_jabber.png" + +/* + The record class for group by informations first screen + */ +class elv1rec : public QObject +{ + Q_OBJECT +public: + + elv1rec(): + m_avatar(QIcon::fromTheme( "general_default_avatar", QIcon(IMG_AVATAR))) + { + } + + QString contact_name() const{ + return m_contact_name; + } + + QString total_call() const{ + return m_total_call; + } + + QIcon avatar() const{ + return m_avatar; + } + + void set_contact_name(QString contact_name){ + m_contact_name = contact_name; + } + + void set_total_call(QString total_call){ + m_total_call = total_call; + } + + void set_avatar(QIcon avatar){ + m_avatar = avatar; + } + +private: + QString m_contact_name; + QString m_total_call; + QIcon m_avatar; +}; + +/* + The record class for detail informations second screen + */ +enum PhoneType { GSM_NETWORK = 0, SKYPE = 1, JABBER = 2, GOOGLE_TALK = 3, UNKNOW = 4}; +enum CallType { OUTGOING = 0, INCOMING = 1, MISSED = 2, ALL_CALL = 3}; + +class elv1Detailrec : public QObject +{ + Q_OBJECT + +public: + + elv1Detailrec() + {} + + void set_phonenumber(QString phonenumber){ m_phonenumber = phonenumber;} + void set_starttime(uint starttime){ m_starttime.setTime_t(starttime);} + void set_endtime(uint endtime){ m_endtime.setTime_t(endtime);} + void set_calltype(CallType calltype){ + m_calltype = calltype; + m_icon = QIcon::fromTheme(calltype==OUTGOING? + "general_sent":calltype==INCOMING? + "general_received":"general_missed", QIcon(calltype==OUTGOING? + IMG_OUTGOING:calltype==INCOMING? + IMG_INCOMING:IMG_MISSED)); + + } + + void set_phonetype(PhoneType phonetype){ + m_phonetype = phonetype; + QString _m_icon_meta; + QString _m_icon_path; + switch (phonetype){ + case GSM_NETWORK: + _m_icon_meta = "call_status_cellular"; + _m_icon_path = IMG_CELL; + break; + case SKYPE: + _m_icon_meta = "general_skype"; + _m_icon_path = IMG_SKYPE; + break; + case JABBER: + _m_icon_meta = "general_jabber"; + _m_icon_path = IMG_JABBER; + break; + case GOOGLE_TALK: + _m_icon_meta = "general_gtalk"; + _m_icon_path = IMG_GOOGLE; + break; + default: + _m_icon_meta = "call_status_unknow"; + _m_icon_path = "unknow"; + break; + } + + m_type_call_icon = QIcon::fromTheme(_m_icon_meta, QIcon(_m_icon_path)); + } + + void set_callduration(uint callduration){ m_callduration = callduration;} + + QString get_phonenumber() const { return m_phonenumber;} + QIcon get_icon() const { return m_icon;} + QIcon get_type_call_icon() const { return m_type_call_icon;} + QTime get_starttime() const { return m_starttime.time();} + QTime get_endtime() const { return m_endtime.time();} + QDate get_startdate() const { return m_starttime.date();} + QDate get_enddate() const { return m_endtime.date();} + CallType get_calltype() const { return m_calltype;} + uint get_duration() const { return m_callduration;} + +private: + QIcon m_icon; //incoming/outgoing/missed call icons + QIcon m_type_call_icon; //cell/skype/sip/jingle/... + QString m_phonenumber; + QDateTime m_starttime; + QDateTime m_endtime; + CallType m_calltype; + PhoneType m_phonetype; + uint m_callduration; +}; + +/* + The main db management class + *MUST* be inherited QThread + */ + + +class elv1db : public QThread +{ + Q_OBJECT +public: + explicit elv1db(QObject *parent = 0); + ~elv1db(); + + void run(); + + void setQuery(QString o_query) { + m_query = o_query; + } + + QString m_contact_name; + + QList m_records; + QList m_detail_records; + + bool m_type_query; + + bool m_all_call; + CallType m_call_type; + +signals: + void start_indicator(); + void group_by_finished(); + void detail_finished(); + void detail_start_indicator(); + +private: + QSqlDatabase m_db; + QString m_query; + + PhoneType phonetype(QString metastr); + QString calltype(); +}; + +#endif // ELV1DB_H diff --git a/listitemdetaildelegate.cc b/listitemdetaildelegate.cc new file mode 100644 index 0000000..6594b11 --- /dev/null +++ b/listitemdetaildelegate.cc @@ -0,0 +1,68 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include "listitemdetaildelegate.h" + +listitemdetailDelegate::listitemdetailDelegate(QObject*) +{ +} + +listitemdetailDelegate::~listitemdetailDelegate(){ + +} + +void listitemdetailDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { + QString header = index.data(Qt::DisplayRole).toString(); + + QRect r = option.rect; + + if (!header.isNull()){ + r.adjust(0,10,0,-10); + QLinearGradient gradientSelected(r.left(),r.top(),r.left(),r.height()+r.top()); + gradientSelected.setColorAt(0.0, QColor::fromRgb(119,213,247)); + gradientSelected.setColorAt(0.9, QColor::fromRgb(27,134,183)); + gradientSelected.setColorAt(1.0, QColor::fromRgb(0,120,174)); + painter->setBrush(gradientSelected); + painter->drawRect(r); + + painter->setPen(Qt::blue); + painter->setFont(QFont("Nokia Sans", 18, QFont::Normal)); + painter->drawText(r.left(), r.top(), r.width(), r.height(), Qt::AlignCenter, header, &r); + }else{ + painter->setPen(Qt::white); + QString phone_number = index.data(Qt::UserRole + 1).toString(); + QString start_end = index.data(Qt::UserRole + 2).toString(); + QIcon icon_type = QIcon(qvariant_cast(index.data(Qt::UserRole+4))); + QIcon icon_call_type = QIcon(qvariant_cast(index.data(Qt::UserRole+5))); + + painter->setFont(QFont("Nokia Sans", 16, QFont::Normal)); + icon_type.paint(painter, r, Qt::AlignVCenter|Qt::AlignLeft); + icon_call_type.paint(painter, r, Qt::AlignVCenter|Qt::AlignRight); + + r = option.rect.adjusted(55, 0, -10, -30); + painter->setFont(QFont("Nokia Sans", 18, QFont::Bold)); + painter->drawText(r.left(), r.top(), r.width(), r.height(), Qt::AlignBottom|Qt::AlignLeft, phone_number, &r); + + painter->setFont(QFont("Nokia Sans", 14, QFont::Normal)); + r = option.rect.adjusted(55, 30, -10, -10); + painter->drawText(r.left(), r.top(), r.width(), r.height(), Qt::AlignBottom|Qt::AlignLeft, start_end, &r); + } +} + +QSize listitemdetailDelegate::sizeHint(const QStyleOptionViewItem&, const QModelIndex&) const { + return QSize(200, 70); +} diff --git a/listitemdetaildelegate.h b/listitemdetaildelegate.h new file mode 100644 index 0000000..0871b33 --- /dev/null +++ b/listitemdetaildelegate.h @@ -0,0 +1,34 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#ifndef LISTITEMDETAILDELEGATE_H +#define LISTITEMDETAILDELEGATE_H + +#include +#include + +class listitemdetailDelegate : public QAbstractItemDelegate +{ +public: + listitemdetailDelegate(QObject *parent = 0); + void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const; + QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const; + + virtual ~listitemdetailDelegate(); +}; + +#endif // LISTITEMDETAILDELEGATE_H diff --git a/loadingbox.cc b/loadingbox.cc new file mode 100644 index 0000000..154123a --- /dev/null +++ b/loadingbox.cc @@ -0,0 +1,23 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include "loadingbox.h" + +loadingbox::loadingbox(QWidget *parent) : + QWidget(parent) +{ +} diff --git a/loadingbox.h b/loadingbox.h new file mode 100644 index 0000000..9d82978 --- /dev/null +++ b/loadingbox.h @@ -0,0 +1,35 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#ifndef LOADINGBOX_H +#define LOADINGBOX_H + +#include + +class loadingbox : public QWidget +{ + Q_OBJECT +public: + explicit loadingbox(QWidget *parent = 0); + +signals: + +public slots: + +}; + +#endif // LOADINGBOX_H diff --git a/main.cc b/main.cc new file mode 100644 index 0000000..9ec7153 --- /dev/null +++ b/main.cc @@ -0,0 +1,31 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include "mainwindow.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + MainWindow mainWindow; + mainWindow.setOrientation(MainWindow::ScreenOrientationAuto); + mainWindow.showExpanded(); + + return app.exec(); +} diff --git a/mainwindow.cc b/mainwindow.cc new file mode 100644 index 0000000..fad4da9 --- /dev/null +++ b/mainwindow.cc @@ -0,0 +1,381 @@ +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include "mainwindow.h" + +#include +#include +#include + + +#include "listitemdetaildelegate.h" + +MainWindow::MainWindow(QWidget *parent): + QMainWindow(parent), + m_elv1db(new elv1db(parent)) +{ + + detail_dlg = new QMainWindow(this); + detail_dlg->installEventFilter(this); + + m_contact_detail = new QListWidget(detail_dlg); + m_contact_detail->setSelectionMode(QAbstractItemView::NoSelection); + m_contact_detail->setObjectName("m_contact_detail"); + detail_dlg->setCentralWidget(m_contact_detail); + #ifdef Q_WS_MAEMO_5 + detail_dlg->setAttribute(Qt::WA_Maemo5StackedWindow); + #endif + + + this->setWindowTitle(QString::fromUtf8("VN Call History")); + + m_contacts_widget = new QTableWidget(0, 3, this); + m_contacts_widget->setProperty( "FingerScrollable", true ); + m_contacts_widget->setSelectionBehavior(QAbstractItemView::SelectRows); + m_contacts_widget->setSelectionMode(QAbstractItemView::SingleSelection); + m_contacts_widget->setIconSize( QSize( 48, 48 ) ); + + m_contacts_widget->horizontalHeader()->setDefaultSectionSize( 30 ); + m_contacts_widget->horizontalHeader()->setResizeMode( 0, QHeaderView::Fixed ); + m_contacts_widget->horizontalHeader()->setResizeMode( 1, QHeaderView::Stretch ); + m_contacts_widget->horizontalHeader()->setResizeMode( 2, QHeaderView::Fixed ); + + m_contacts_widget->verticalHeader()->hide(); + m_contacts_widget->horizontalHeader()->hide(); + + connect(m_contacts_widget, SIGNAL(cellClicked(int,int)), this, SLOT(cellClicked(int,int))); + + m_elv1db->m_type_query = 0; + + connect(m_elv1db, SIGNAL(group_by_finished()), this, SLOT(elv1db_finised())); + connect(m_elv1db, SIGNAL(detail_finished()), this, SLOT(elv1db_detail_finised())); + connect(m_elv1db, SIGNAL(start_indicator()), this, SLOT(start_indicator())); + connect(m_elv1db, SIGNAL(detail_start_indicator()), this, SLOT(detail_start_indicator())); + + this->setup_menu(); + this->setup_menu_detail(); + + this->setCentralWidget(m_contacts_widget); + + m_elv1db->m_call_type = ALL_CALL; + m_elv1db->m_all_call = false; + m_elv1db->start(); + +#ifdef Q_WS_MAEMO_5 + this->setAttribute(Qt::WA_Maemo5StackedWindow); +#endif + +} + +MainWindow::~MainWindow() +{ + delete this->m_contacts_widget; + delete this->m_contact_detail; + delete this->m_elv1db; +} + +void MainWindow::cellClicked(int row, int col){ + qDebug() << "cellClicked : " << row << ":" << col; + + m_contact_detail->clear(); + + const elv1rec *ef= m_elv1db->m_records.at(row); + + m_elv1db->m_contact_name = ef->contact_name(); + + detail_dlg->setWindowTitle(ef->contact_name()); + detail_dlg->show(); + + m_elv1db->m_type_query = 1; + m_elv1db->start(); +} + +void MainWindow::elv1db_detail_finised(){ + QDate t_cache; + + m_contact_detail->setItemDelegate(new listitemdetailDelegate(m_contact_detail)); + + foreach(elv1Detailrec *ef, m_elv1db->m_detail_records){ + QString detail_format("%1 | %2 | Duration: %3"); + QTime final_duration; + + uint secs = ef->get_duration() % 60; + uint mins = ef->get_duration() / 60; + uint hours = ef->get_duration() / 3600; + + final_duration.setHMS(hours,mins,secs); + + if ((t_cache.day()!=ef->get_startdate().day()) || + (t_cache.month()!=ef->get_startdate().month()) || + (t_cache.year()!=ef->get_startdate().year()) ){ + + QListWidgetItem *header = new QListWidgetItem(); + header->setData(Qt::DisplayRole, ef->get_startdate().toString()); + m_contact_detail->addItem(header); + + t_cache=ef->get_startdate(); + } + + QListWidgetItem *item = new QListWidgetItem(); + item->setData(Qt::UserRole + 1, ef->get_phonenumber()); + item->setData(Qt::UserRole + 2, detail_format.arg(ef->get_starttime().toString()) + .arg(ef->get_endtime().toString()) + .arg(final_duration.toString())); + item->setData(Qt::UserRole + 4, ef->get_icon()); + item->setData(Qt::UserRole + 5, ef->get_type_call_icon()); + m_contact_detail->addItem(item); + } + + this->me_indicator(this->detail_dlg, false); + m_elv1db->m_type_query = 0; +} + +void MainWindow::elv1db_finised(){ + qDebug() << " Process the elv1 database is done"; + + m_contacts_widget->clear(); + m_contacts_widget->setRowCount(0); + + int i=0; + + foreach(elv1rec *ef,m_elv1db->m_records){ + QTableWidgetItem *m_thumbnail = new QTableWidgetItem; + m_thumbnail->setIcon(ef->avatar()); + + m_contacts_widget->insertRow(i); + m_contacts_widget->setItem(i,0, m_thumbnail); + + QString _m_total_call(" (%1) "); + _m_total_call = _m_total_call.arg(ef->total_call()); + + QString _m_contact_name(" %1"); + _m_contact_name = _m_contact_name.arg(ef->contact_name()); + + QLabel *m_total_call = new QLabel(_m_total_call); + m_total_call->setAlignment(Qt::AlignCenter); + + m_contacts_widget->setCellWidget(i,1, new QLabel(_m_contact_name)); + m_contacts_widget->setCellWidget(i,2, m_total_call); + i++; + } + + m_contacts_widget->resizeRowsToContents(); + m_contacts_widget->resizeColumnsToContents(); + + this->stop_indicator(); + + m_contacts_widget->setEnabled(true); +} + +void MainWindow::start_indicator(){ + this->me_indicator(this, true); +} + +void MainWindow::stop_indicator(){ + this->me_indicator(this, false); +} + +void MainWindow::detail_start_indicator(){ + this->me_indicator(this->detail_dlg, true); +} + +void MainWindow::me_indicator(QMainWindow *qmw, bool m_show){ + qmw->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, m_show); +} + +void MainWindow::setup_menu(){ + QActionGroup* m_type_group = new QActionGroup(this); + m_type_group->setExclusive(true); + m_type_group->setObjectName("m_type_group"); + + QAction* m_all_calls = new QAction(QString::fromUtf8("All call"), m_type_group ); + m_all_calls->setCheckable(true); + m_all_calls->setObjectName( "m_all_calls" ); + connect(m_all_calls, SIGNAL(triggered()), this, SLOT(select_all_call())); + + QAction* m_gsm_calls = new QAction(QString::fromUtf8("GSM cellular"), m_type_group ); + m_gsm_calls->setCheckable(true); + m_gsm_calls->setObjectName("m_gsm_calls"); + connect(m_gsm_calls, SIGNAL(triggered()), this, SLOT(select_gsm_calls())); + + m_gsm_calls->setChecked(true); + + + QActionGroup* m_type_group_af = new QActionGroup(this); + m_type_group_af->setExclusive(true); + m_type_group_af->setObjectName("m_type_group_detail"); + + QAction* m_all = new QAction(QString::fromUtf8("All"), m_type_group_af ); + m_all->setCheckable(true); + m_all->setObjectName( "m_all" ); + connect(m_all, SIGNAL(triggered()), this, SLOT(select_all_typecall())); + + QAction* m_incoming = new QAction(QString::fromUtf8("Incoming"), m_type_group_af ); + m_incoming->setCheckable(true); + m_incoming->setObjectName( "m_incoming" ); + connect(m_incoming, SIGNAL(triggered()), this, SLOT(select_incoming_calls())); + + QAction* m_outgoing = new QAction(QString::fromUtf8("Outgoing"), m_type_group_af ); + m_outgoing->setCheckable(true); + m_outgoing->setObjectName( "m_outgoing" ); + connect(m_outgoing, SIGNAL(triggered()), this, SLOT(select_outgoing_calls())); + + QAction* m_missed = new QAction(QString::fromUtf8("Missed"), m_type_group_af ); + m_missed->setCheckable(true); + m_missed->setObjectName( "m_missed" ); + connect(m_missed, SIGNAL(triggered()), this, SLOT(select_missed_calls())); + + m_all->setChecked(true); + + this->menuBar()->addActions(m_type_group->actions()); + this->menuBar()->addActions(m_type_group_af->actions()); + +/* QAction *m_clear_log = this->menuBar()->addAction("Clear Log"); + QAction *m_options = this->menuBar()->addAction(QString::fromUtf8("Options")); + + connect(m_clear_log,SIGNAL(triggered()), this, SLOT(clearLog())); + connect(m_options, SIGNAL(triggered()), this, SLOT(dlgOptions()));*/ + + QAction *m_about = this->menuBar()->addAction("About"); + QAction *m_about_qt = this->menuBar()->addAction("About Qt"); + + connect(m_about,SIGNAL(triggered()), this, SLOT(dlgAbout())); + connect(m_about_qt,SIGNAL(triggered()), qApp, SLOT(aboutQt())); + +} + +void MainWindow::select_all_call(){ //ring/tel/ring, spirit/skype, gabble/jabber + m_contacts_widget->setEnabled(false); + m_elv1db->m_all_call = true; + m_elv1db->start(); +} + +void MainWindow::select_gsm_calls(){ //ring/tel/ring + m_contacts_widget->setEnabled(false); + m_elv1db->m_all_call = false; + m_elv1db->start(); +} + +void MainWindow::select_all_typecall(){ //incoming, outgoing and missed calls + m_contacts_widget->setEnabled(false); + m_elv1db->m_call_type = ALL_CALL; + m_elv1db->start(); +} + +void MainWindow::select_incoming_calls(){ + m_contacts_widget->setEnabled(false); + m_elv1db->m_call_type = INCOMING; + m_elv1db->start(); +} + +void MainWindow::select_outgoing_calls(){ + m_contacts_widget->setEnabled(false); + m_elv1db->m_call_type = OUTGOING; + m_elv1db->start(); +} + +void MainWindow::select_missed_calls(){ + m_contacts_widget->setEnabled(false); + m_elv1db->m_call_type = MISSED; + m_elv1db->start(); +} + +void MainWindow::clearLog(){ +} + +void MainWindow::setup_menu_detail(){ +} + +void MainWindow::dlgAbout(){ + QMessageBox m_about; + m_about.setWindowTitle("About"); + m_about.setText( + "VN Call History
" + "Version : 0.0.1 (09/28/2011)
" + "Author : Cuong Le metacuong@gmail.com
" + "" + "Homepage : http://vncallhistory.garage.maemo.org/
" + "Bugs report : https://garage.maemo.org/tracker/?group_id=2259
" + "License : GNU/GPL version 2" + "
" + ); + m_about.exec(); +} + +void MainWindow::dlgOptions(){ + dlg_options = new QMainWindow(this); + dlg_options->setWindowTitle(QString::fromUtf8("Options")); + dlg_options->installEventFilter(this); +#ifdef Q_WS_MAEMO_5 + dlg_options->setAttribute(Qt::WA_Maemo5StackedWindow); +#endif + dlg_options->show(); +} + +void MainWindow::setOrientation(ScreenOrientation orientation) +{ +#if defined(Q_OS_SYMBIAN) + // If the version of Qt on the device is < 4.7.2, that attribute won't work + if (orientation != ScreenOrientationAuto) { + const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); + if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { + qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); + return; + } + } +#endif // Q_OS_SYMBIAN + + Qt::WidgetAttribute attribute; + switch (orientation) { +#if QT_VERSION < 0x040702 + // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes + case ScreenOrientationLockPortrait: + attribute = static_cast(128); + break; + case ScreenOrientationLockLandscape: + attribute = static_cast(129); + break; + default: + case ScreenOrientationAuto: + attribute = static_cast(130); + break; +#else // QT_VERSION < 0x040702 + case ScreenOrientationLockPortrait: + attribute = Qt::WA_LockPortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_LockLandscapeOrientation; + break; + default: + case ScreenOrientationAuto: + attribute = Qt::WA_AutoOrientation; + break; +#endif // QT_VERSION < 0x040702 + }; + setAttribute(attribute, true); +} + +void MainWindow::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) + showMaximized(); +#else + show(); +#endif +} diff --git a/mainwindow.h b/mainwindow.h new file mode 100644 index 0000000..ac6be0a --- /dev/null +++ b/mainwindow.h @@ -0,0 +1,88 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +/* +Copyright (C) 2011 by Cuong Le + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include + +#include "elv1db.h" + +#include + +class QTableWidget; +class QTableWidgetItem; +class QListWidget; + +class MainWindow : public QMainWindow +{ + Q_OBJECT +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit MainWindow(QWidget *parent = 0); + virtual ~MainWindow(); + + // Note that this will only have an effect on Symbian and Fremantle. + void setOrientation(ScreenOrientation orientation); + + void showExpanded(); + +private slots: + void dlgAbout(); + void clearLog(); + void dlgOptions(); + void elv1db_finised(); + + void start_indicator(); + void stop_indicator(); + + void elv1db_detail_finised(); + + void cellClicked(int, int); + + void detail_start_indicator(); + + void select_gsm_calls(); + void select_all_call(); + + void select_all_typecall(); + void select_incoming_calls(); + void select_outgoing_calls(); + void select_missed_calls(); + +private: + QTableWidget *m_contacts_widget; + QListWidget *m_contact_detail; + + QMainWindow *dlg_options; + + void setup_menu(); + void setup_menu_detail(); + + elv1db *m_elv1db; + + QMainWindow *detail_dlg; + + void me_indicator(QMainWindow*, bool); +}; + +#endif // MAINWINDOW_H diff --git a/qtc_packaging/debian_fremantle/README b/qtc_packaging/debian_fremantle/README new file mode 100644 index 0000000..fb628fe --- /dev/null +++ b/qtc_packaging/debian_fremantle/README @@ -0,0 +1,6 @@ +The Debian Package vcallhistory +---------------------------- + +Comments regarding the Package + + -- Cuong Le Sun, 25 Sep 2011 14:31:43 +0700 diff --git a/qtc_packaging/debian_fremantle/changelog b/qtc_packaging/debian_fremantle/changelog new file mode 100644 index 0000000..3479957 --- /dev/null +++ b/qtc_packaging/debian_fremantle/changelog @@ -0,0 +1,5 @@ +vcallhistory (0.0.1) unstable; urgency=low + + * First beta release. + + -- Cuong Le Sun, 25 Sep 2011 14:31:43 +0700 diff --git a/qtc_packaging/debian_fremantle/compat b/qtc_packaging/debian_fremantle/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/qtc_packaging/debian_fremantle/compat @@ -0,0 +1 @@ +7 diff --git a/qtc_packaging/debian_fremantle/control b/qtc_packaging/debian_fremantle/control new file mode 100644 index 0000000..5dcb169 --- /dev/null +++ b/qtc_packaging/debian_fremantle/control @@ -0,0 +1,15 @@ +Source: vcallhistory +Section: user/utilities +Priority: optional +Maintainer: Cuong Le +Build-Depends: debhelper (>= 5), libqt4-dev +Standards-Version: 3.7.3 +Homepage: http://vncallhistory.garage.maemo.org/ + +Package: vcallhistory +Architecture: armel +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Just another call history manager for Maemo 5 (Fremantle PR 1.2 and PR 1.3). +XB-Maemo-Display-Name: VN Call History +XSBC-Bugtracker: https://garage.maemo.org/tracker/?group_id=2259 +XB-Maemo-Icon-26: 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 diff --git a/qtc_packaging/debian_fremantle/copyright b/qtc_packaging/debian_fremantle/copyright new file mode 100644 index 0000000..e9a8446 --- /dev/null +++ b/qtc_packaging/debian_fremantle/copyright @@ -0,0 +1,38 @@ +This package was debianized by Cuong Le on +Sun, 25 Sep 2011 14:31:43 +0700. + +It was downloaded from + +Upstream Author(s): + + Cuong Le + +Copyright: + + Copyright (C) 2011 Cuong Le> + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2011, Cuong Le and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/qtc_packaging/debian_fremantle/rules b/qtc_packaging/debian_fremantle/rules new file mode 100755 index 0000000..a82c259 --- /dev/null +++ b/qtc_packaging/debian_fremantle/rules @@ -0,0 +1,72 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +APPNAME := vcallhistory +builddir: + mkdir -p builddir + +builddir/Makefile: builddir + cd builddir && qmake-qt4 PREFIX=/usr ../$(APPNAME).pro + +build: build-stamp + +build-stamp: builddir/Makefile + dh_testdir + + # Add here commands to compile the package. + cd builddir && $(MAKE) + #docbook-to-man debian/$(APPNAME).sgml > $(APPNAME).1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + # Add here commands to clean up after the build process. + rm -rf builddir + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/arora. + cd builddir && $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/$(APPNAME) install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/vcallhistory.desktop b/vcallhistory.desktop new file mode 100644 index 0000000..3bd6fb2 --- /dev/null +++ b/vcallhistory.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=VN Call History +Exec=/opt/vcallhistory/bin/vcallhistory +Icon=vcallhistory +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/vcallhistory.png b/vcallhistory.png new file mode 100644 index 0000000..b4f05b0 Binary files /dev/null and b/vcallhistory.png differ diff --git a/vcallhistory.pro b/vcallhistory.pro new file mode 100644 index 0000000..7964593 --- /dev/null +++ b/vcallhistory.pro @@ -0,0 +1,51 @@ +# Add files and directories to ship with the application +# by adapting the examples below. +# file1.source = myfile +# dir1.source = mydir +DEPLOYMENTFOLDERS = # file1 dir1 + +CONFIG += mobility qdbus +MOBILITY = contacts +QT += sql + +symbian:TARGET.UID3 = 0xE540C47E + +# Smart Installer package's UID +# This UID is from the protected range +# and therefore the package will fail to install if self-signed +# By default qmake uses the unprotected range value if unprotected UID is defined for the application +# and 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Allow network access on Symbian +symbian:TARGET.CAPABILITY += NetworkServices + +# If your application uses the Qt Mobility libraries, uncomment +# the following lines and add the respective components to the +# MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +SOURCES += \ + main.cc \ + mainwindow.cc \ + elv1db.cc \ + loadingbox.cc \ + listitemdetaildelegate.cc +HEADERS += mainwindow.h \ + elv1db.h \ + loadingbox.h \ + listitemdetaildelegate.h +FORMS += + +# Please do not modify the following two lines. Required for deployment. +include(deployment.pri) +qtcAddDeployment() + +OTHER_FILES += \ + qtc_packaging/debian_fremantle/rules \ + qtc_packaging/debian_fremantle/README \ + qtc_packaging/debian_fremantle/copyright \ + qtc_packaging/debian_fremantle/control \ + qtc_packaging/debian_fremantle/compat \ + qtc_packaging/debian_fremantle/changelog diff --git a/vcallhistory.svg b/vcallhistory.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/vcallhistory.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + +