| 648 | } |
| 649 | |
| 650 | void CFrmRecent::dropEvent(QDropEvent *event) |
| 651 | { |
| 652 | //qDebug(log) << Q_FUNC_INFO; |
| 653 | bool bRet = false; |
| 654 | auto urls = event->mimeData()->urls(); |
| 655 | foreach(auto url, urls) |
| 656 | { |
| 657 | if(url.isLocalFile()) { |
| 658 | QString filename = url.toLocalFile(); |
| 659 | if (m_Database.ImportFromJsonFile(filename)) { |
| 660 | slotRefresh(); |
| 661 | emit sigShowMessageBox(tr("Success"), |
| 662 | tr("Successfully imported recent from json file"), |
| 663 | QMessageBox::Information); |
| 664 | } else { |
| 665 | QString szErr = tr("Failed to import recent from json file: %1").arg(filename) + "\n"; |
| 666 | if(!m_Database.GetError().isEmpty()) |
| 667 | szErr += "\n" + tr("Error: ") + m_Database.GetError(); |
| 668 | emit sigShowMessageBox(tr("Failure"), szErr, QMessageBox::Critical); |
| 669 | } |
| 670 | } |
| 671 | } |
| 672 | if(bRet) |
| 673 | event->accept(); |
| 674 | else |
| 675 | event->ignore(); |
| 676 | } |
| 677 | |
| 678 | bool CFrmRecent::eventFilter(QObject *watched, QEvent *event) |
| 679 | { |