~smartboyhw/ubuntu/raring/calligra/2.6.0-0ubuntu1

« back to all changes in this revision

Viewing changes to kexi/main/KexiMainWindow.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-10-23 21:09:16 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20121023210916-m82w6zxnxhaxz7va
Tags: 1:2.5.90-0ubuntu1
* New upstream alpha release (LP: #1070436)
  - Add libkactivities-dev and libopenimageio-dev to build-depends
  - Add kubuntu_build_calligraactive.diff to build calligraactive by default
  - Add package for calligraauthor and move files that are shared between
    calligrawords and calligraauthor to calligrawords-common
* Document the patches
* Remove numbers from patches so they follow the same naming scheme as
  the rest of our patches.
* calligra-data breaks replaces krita-data (<< 1:2.5.3) (LP: #1071686)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* This file is part of the KDE project
2
2
   Copyright (C) 2003 Lucijan Busch <lucijan@kde.org>
3
 
   Copyright (C) 2003-2011 Jarosław Staniek <staniek@kde.org>
 
3
   Copyright (C) 2003-2012 Jarosław Staniek <staniek@kde.org>
4
4
 
5
5
   This library is free software; you can redistribute it and/or
6
6
   modify it under the terms of the GNU Library General Public
72
72
#include <KXMLGUIFactory>
73
73
#include <KMultiTabBar>
74
74
 
75
 
#include <kexidb/connection.h>
76
 
#include <kexidb/utils.h>
77
 
#include <kexidb/cursor.h>
 
75
#include <db/connection.h>
 
76
#include <db/utils.h>
 
77
#include <db/cursor.h>
 
78
#include <db/admin.h>
78
79
#include <kexidb/dbobjectnamevalidator.h>
79
 
#include <kexidb/admin.h>
80
80
#include <kexiutils/utils.h>
81
81
 
82
82
#include <core/KexiWindow.h>
114
114
#include "startup/KexiStartupDialog.h"
115
115
#include "kexinamedialog.h"
116
116
 
 
117
#include <KoIcon.h>
 
118
 
117
119
//2.x #include "printing/kexisimpleprintingpart.h"
118
120
//2.x #include "printing/kexisimpleprintingpagesetup.h"
119
121
 
171
173
        , m_mainWidget(mainWidget)
172
174
        , m_tabIndex(-1)
173
175
{
174
 
    m_closeAction = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this);
 
176
    m_closeAction = new KAction(koIcon("tab-close"), i18n("&Close Tab"), this);
175
177
    m_closeAction->setToolTip(i18n("Close the current tab"));
176
178
    m_closeAction->setWhatsThis(i18n("Closes the current tab."));
177
179
    connect(m_closeAction, SIGNAL(triggered()), this, SLOT(closeTab()));
307
309
        kDebug() << "KexiMainWindow::KexiMainWindow(): starting up in the User Mode";
308
310
 
309
311
    setAsDefaultHost(); //this is default host now.
310
 
    KIconLoader::global()->addAppDir("kexi");
311
 
    KIconLoader::global()->addAppDir("calligra");
 
312
    KIconLoader *globalIconLoader = KIconLoader::global();
 
313
    globalIconLoader->addAppDir(QLatin1String("kexi"));
 
314
    globalIconLoader->addAppDir(QLatin1String("calligra"));
312
315
 
313
316
    //get informed
314
317
    connect(&Kexi::partManager(), SIGNAL(partLoaded(KexiPart::Part*)),
328
331
        setupPropertyEditor();
329
332
    }
330
333
 
331
 
    d->tabbedToolBar->hideTab("form");//temporalily until createToolbar is splitted
332
 
    d->tabbedToolBar->hideTab("report");//temporalily until createToolbar is splitted
 
334
    d->tabbedToolBar->hideTab("form");//temporalily until createToolbar is split
 
335
    d->tabbedToolBar->hideTab("report");//temporalily until createToolbar is split
333
336
 
334
337
    invalidateActions();
335
338
    d->timer.singleShot(0, this, SLOT(slotLastActions()));
464
467
    setupMainMenuActionShortcut(action, SLOT(slotProjectOpen()));
465
468
 
466
469
#ifdef HAVE_KNEWSTUFF
467
 
    action = addAction("project_download_examples", KIcon("go-down"),
 
470
    action = addAction("project_download_examples", koIcon("go-down"),
468
471
                       i18n("&Download Example Databases..."));
469
472
    action->setToolTip(i18n("Download example databases from the Internet"));
470
473
    action->setWhatsThis(i18n("Downloads example databases from the Internet."));
489
492
    d->action_save->setWhatsThis(i18n("Saves object changes from currently selected window."));
490
493
 
491
494
#ifdef KEXI_SHOW_UNIMPLEMENTED
492
 
    d->action_save_as = addAction("project_saveas", KIcon("document-save-as"),
 
495
    d->action_save_as = addAction("project_saveas", koIcon("document-save-as"),
493
496
                                  i18n("Save &As..."));
494
497
    d->action_save_as->setToolTip(i18n("Save object as"));
495
498
    d->action_save_as->setWhatsThis(
499
502
 
500
503
    ac->addAction("project_properties",
501
504
        action = d->action_project_properties = new KexiMenuWidgetAction(
502
 
            KIcon("document-properties"), i18n("Project Properties"), this));
 
505
            koIcon("document-properties"), i18n("Project Properties"), this));
503
506
    connect(action, SIGNAL(triggered()), this, SLOT(slotProjectProperties()));
504
507
    setupMainMenuActionShortcut(action, SLOT(slotProjectProperties()));
505
508
#else
514
517
#endif
515
518
    ac->addAction("project_import_export_send",
516
519
        action = d->action_project_import_export_send = new KexiMenuWidgetAction(
517
 
            KIcon("document-import"), i18n("&Import, Export or Send..."), this));
 
520
            koIcon("document-import"), i18n("&Import, Export or Send..."), this));
518
521
    action->setToolTip(i18n("Import, export or send project"));
519
522
    action->setWhatsThis(
520
523
        i18n("Imports, exports or sends project."));
523
526
 
524
527
    ac->addAction("project_close",
525
528
        action = d->action_close = new KexiMenuWidgetAction(
526
 
            KIcon("window-close"), i18nc("Close Project", "&Close"), this));
 
529
            koIcon("window-close"), i18nc("Close Project", "&Close"), this));
527
530
    action->setToolTip(i18n("Close the current project"));
528
531
    action->setWhatsThis(i18n("Closes the current project."));
529
532
    connect(action, SIGNAL(triggered()), this, SLOT(slotProjectClose()));
536
539
    setupMainMenuActionShortcut(action, SLOT(slotProjectQuit()));
537
540
 
538
541
#ifdef KEXI_SHOW_UNIMPLEMENTED
539
 
    d->action_project_relations = addAction("project_relations", KIcon("relation"),
 
542
    d->action_project_relations = addAction("project_relations", koIcon("relation"),
540
543
                                            i18n("&Relationships..."), "Ctrl+R");
541
544
    d->action_project_relations->setToolTip(i18n("Project relationships"));
542
545
    d->action_project_relations->setWhatsThis(i18n("Shows project relationships."));
546
549
#else
547
550
    d->action_project_relations = d->dummy_action;
548
551
#endif
549
 
    d->action_tools_import_project = addAction("tools_import_project", KIcon("document_import_database"),
 
552
    d->action_tools_import_project = addAction("tools_import_project", koIcon("document_import_database"),
550
553
                                               i18n("&Import Database..."));
551
554
    d->action_tools_import_project->setToolTip(i18n("Import entire database as a Kexi project"));
552
555
    d->action_tools_import_project->setWhatsThis(
554
557
    connect(d->action_tools_import_project, SIGNAL(triggered()),
555
558
            this, SLOT(slotToolsImportProject()));
556
559
 
557
 
    d->action_tools_data_import = addAction("tools_import_tables", KIcon("document-import"),
 
560
    d->action_tools_data_import = addAction("tools_import_tables", koIcon("document-import"),
558
561
                                            i18n("Import Tables"));
559
562
    d->action_tools_data_import->setToolTip(i18n("Import data from an external source into this database"));
560
563
    d->action_tools_data_import->setWhatsThis(i18n("Import data from an external source into this database"));
562
565
 
563
566
    d->action_tools_compact_database = addAction("tools_compact_database",
564
567
//! @todo icon
565
 
                                                 KIcon("kexi"), i18n("&Compact Database..."));
 
568
                                                 koIcon("kexi"), i18n("&Compact Database..."));
566
569
    d->action_tools_compact_database->setToolTip(i18n("Compact the current database project"));
567
570
    d->action_tools_compact_database->setWhatsThis(
568
571
        i18n("Compacts the current database project, so it will take less space and work faster."));
573
576
        d->action_project_import_data_table = 0;
574
577
    else {
575
578
        d->action_project_import_data_table = addAction("project_import_data_table",
576
 
            KIcon("table"), 
 
579
            koIcon("table"), 
577
580
            /*! @todo: change to "file_import" with a table or so */
578
581
            i18nc("Import->Table Data From File...", "Import Data From &File..."));
579
582
        d->action_project_import_data_table->setToolTip(i18n("Import table data from a file"));
583
586
    }
584
587
 
585
588
    d->action_project_export_data_table = addAction("project_export_data_table",
586
 
        KIcon("table"),
 
589
        koIcon("table"),
587
590
        /*! @todo: change to "file_export" with a table or so */
588
591
        i18nc("Export->Table or Query Data to File...", "Export Data to &File..."));
589
592
    d->action_project_export_data_table->setToolTip(
613
616
        i18n("Shows print preview for the active table or query."));
614
617
 
615
618
    d->action_project_print_setup = addAction("project_print_setup",
616
 
        KIcon("document-page-setup"), i18n("Page Set&up..."));
 
619
        koIcon("document-page-setup"), i18n("Page Set&up..."));
617
620
    d->action_project_print_setup->setToolTip(
618
621
        i18n("Show page setup for printing the active table or query"));
619
622
    d->action_project_print_setup->setWhatsThis(
632
635
    else {
633
636
        d->action_edit_paste_special_data_table = addAction(
634
637
            "edit_paste_special_data_table",
635
 
            KIcon("table"), i18nc("Paste Special->As Data &Table...", "Paste Special..."));
 
638
            koIcon("table"), i18nc("Paste Special->As Data &Table...", "Paste Special..."));
636
639
        d->action_edit_paste_special_data_table->setToolTip(
637
640
            i18n("Paste clipboard data as a table"));
638
641
        d->action_edit_paste_special_data_table->setWhatsThis(
643
646
 
644
647
    d->action_edit_copy_special_data_table = addAction(
645
648
        "edit_copy_special_data_table",
646
 
        KIcon("table"), i18nc("Copy Special->Table or Query Data...", "Copy Special..."));
 
649
        koIcon("table"), i18nc("Copy Special->Table or Query Data...", "Copy Special..."));
647
650
    d->action_edit_copy_special_data_table->setToolTip(
648
651
        i18n("Copy selected table or query data to clipboard"));
649
652
    d->action_edit_copy_special_data_table->setWhatsThis(
685
688
    d->action_edit_select_all =  createSharedAction(KStandardAction::SelectAll,
686
689
                                 "edit_select_all");
687
690
 
688
 
    d->action_edit_delete = createSharedAction(i18n("&Delete"), "edit-delete",
 
691
    d->action_edit_delete = createSharedAction(i18n("&Delete"), koIconName("edit-delete"),
689
692
                            KShortcut(), "edit_delete");
690
693
    d->action_edit_delete->setToolTip(i18n("Delete selected object"));
691
694
    d->action_edit_delete->setWhatsThis(i18n("Deletes currently selected object."));
692
695
 
693
 
    d->action_edit_delete_row = createSharedAction(i18n("Delete Record"), "delete_table_row",
 
696
    d->action_edit_delete_row = createSharedAction(i18n("Delete Record"), koIconName("delete_table_row"),
694
697
                                KShortcut(Qt::CTRL + Qt::Key_Delete), "edit_delete_row");
695
698
    d->action_edit_delete_row->setToolTip(i18n("Delete currently selected record"));
696
699
    d->action_edit_delete_row->setWhatsThis(i18n("Deletes currently selected record."));
697
700
 
698
701
    d->action_edit_clear_table = createSharedAction(i18n("Clear Table Contents"),
699
 
                                 "clear_table_contents", KShortcut(), "edit_clear_table");
 
702
                                 koIconName("clear_table_contents"), KShortcut(), "edit_clear_table");
700
703
    d->action_edit_clear_table->setToolTip(i18n("Clear table contents"));
701
704
    d->action_edit_clear_table->setWhatsThis(i18n("Clears table contents."));
702
705
    setActionVolatile(d->action_edit_clear_table, true);
703
706
 
704
 
    d->action_edit_edititem = createSharedAction(i18n("Edit Item"), 0,
 
707
    d->action_edit_edititem = createSharedAction(i18n("Edit Item"), QString(),
705
708
                              KShortcut(), /* CONFLICT in TV: Qt::Key_F2,  */
706
709
                              "edit_edititem");
707
710
    d->action_edit_edititem->setToolTip(i18n("Edit currently selected item"));
708
711
    d->action_edit_edititem->setWhatsThis(i18n("Edits currently selected item."));
709
712
 
710
713
    d->action_edit_insert_empty_row = createSharedAction(i18n("&Insert Empty Row"),
711
 
                                      "insert_table_row", KShortcut(Qt::SHIFT | Qt::CTRL | Qt::Key_Insert),
 
714
                                      koIconName("insert_table_row"), KShortcut(Qt::SHIFT | Qt::CTRL | Qt::Key_Insert),
712
715
                                      "edit_insert_empty_row");
713
716
    setActionVolatile(d->action_edit_insert_empty_row, true);
714
717
    d->action_edit_insert_empty_row->setToolTip(i18n("Insert one empty row above"));
721
724
        d->action_view_mode = new QActionGroup(this);
722
725
        ac->addAction( "view_data_mode",
723
726
          d->action_view_data_mode = new KToggleAction(
724
 
            KIcon("state_data"), i18n("&Data View"), d->action_view_mode) );
 
727
            koIcon("state_data"), i18n("&Data View"), d->action_view_mode) );
725
728
    //  d->action_view_data_mode->setObjectName("view_data_mode");
726
729
        d->action_view_data_mode->setShortcut(QKeySequence("F6"));
727
730
        //d->action_view_data_mode->setExclusiveGroup("view_mode");
739
742
      if (!d->userMode) {
740
743
        ac->addAction( "view_design_mode",
741
744
          d->action_view_design_mode = new KToggleAction(
742
 
            KIcon("state_edit"), i18n("D&esign View"), d->action_view_mode) );
 
745
            koIcon("state_edit"), i18n("D&esign View"), d->action_view_mode) );
743
746
    //  d->action_view_design_mode->setObjectName("view_design_mode");
744
747
        d->action_view_design_mode->setShortcut(QKeySequence("F7"));
745
748
        //d->action_view_design_mode->setExclusiveGroup("view_mode");
755
758
      if (!d->userMode) {
756
759
        ac->addAction( "view_text_mode",
757
760
          d->action_view_text_mode = new KToggleAction(
758
 
            KIcon("state_sql"), i18n("&Text View"), d->action_view_mode) );
 
761
            koIcon("state_sql"), i18n("&Text View"), d->action_view_mode) );
759
762
        d->action_view_text_mode->setObjectName("view_text_mode");
760
763
        d->action_view_text_mode->setShortcut(QKeySequence("F8"));
761
764
        //d->action_view_text_mode->setExclusiveGroup("view_mode");
803
806
    // (connection is added elsewhere)
804
807
 
805
808
    //DATA MENU
806
 
    d->action_data_save_row = createSharedAction(i18n("&Save Record"), "dialog-ok",
 
809
    d->action_data_save_row = createSharedAction(i18n("&Save Record"), koIconName("dialog-ok"),
807
810
                              KShortcut(Qt::SHIFT + Qt::Key_Return), "data_save_row");
808
811
    d->action_data_save_row->setToolTip(i18n("Save changes made to the current record"));
809
812
    d->action_data_save_row->setWhatsThis(i18n("Saves changes made to the current record."));
810
813
//temp. disable because of problems with volatile actions setActionVolatile( d->action_data_save_row, true );
811
814
 
812
815
    d->action_data_cancel_row_changes = createSharedAction(i18n("&Cancel Record Changes"),
813
 
                                        "dialog-cancel", KShortcut(), "data_cancel_row_changes");
 
816
                                        koIconName("dialog-cancel"), KShortcut(), "data_cancel_row_changes");
814
817
    d->action_data_cancel_row_changes->setToolTip(
815
818
        i18n("Cancel changes made to the current record"));
816
819
    d->action_data_cancel_row_changes->setWhatsThis(
818
821
//temp. disable because of problems with volatile actions setActionVolatile( d->action_data_cancel_row_changes, true );
819
822
 
820
823
    d->action_data_execute = createSharedAction(
821
 
                                 i18n("&Execute"), "media-playback-start", KShortcut(), "data_execute");
 
824
                                 i18n("&Execute"), koIconName("media-playback-start"), KShortcut(), "data_execute");
822
825
    //d->action_data_execute->setToolTip(i18n("")); //TODO
823
826
    //d->action_data_execute->setWhatsThis(i18n("")); //TODO
824
827
 
825
828
#ifndef KEXI_SHOW_UNIMPLEMENTED
826
 
    action = createSharedAction(i18n("&Filter"), "view-filter", KShortcut(), "data_filter");
 
829
    action = createSharedAction(i18n("&Filter"), koIconName("view-filter"), KShortcut(), "data_filter");
827
830
    setActionVolatile(action, true);
828
831
#endif
829
832
// action->setToolTip(i18n("")); //todo
831
834
 
832
835
// setSharedMenu("data_sort");
833
836
    /* moved to KexiStandardAction
834
 
      action = createSharedAction(i18n("&Ascending"), "sort_az", KShortcut(), "data_sort_az");
 
837
      action = createSharedAction(i18n("&Ascending"), koIconName("sort_az"), KShortcut(), "data_sort_az");
835
838
    //temp. disable because of problems with volatile actions setActionVolatile( action, true );
836
839
      action->setToolTip(i18n("Sort data in ascending order"));
837
840
      action->setWhatsThis(i18n("Sorts data in ascending order (from A to Z and from 0 to 9). Data from selected column is used for sorting."));
838
841
 
839
 
      action = createSharedAction(i18n("&Descending"), "sort_za", KShortcut(), "data_sort_za");
 
842
      action = createSharedAction(i18n("&Descending"), koIconName("sort_za"), KShortcut(), "data_sort_za");
840
843
    //temp. disable because of problems with volatile actions setActionVolatile( action, true );
841
844
      action->setToolTip(i18n("Sort data in descending order"));
842
845
      action->setWhatsThis(i18n("Sorts data in descending (from Z to A and from 9 to 0). Data from selected column is used for sorting."));
849
852
    createSharedAction(KexiRecordNavigator::Actions::moveToNewRecord(), KShortcut(), "data_go_to_new_record");
850
853
 
851
854
    //FORMAT MENU
852
 
    d->action_format_font = createSharedAction(i18n("&Font..."), "fonts",
 
855
    d->action_format_font = createSharedAction(i18n("&Font..."), koIconNameWanted("change font of selected object","fonts"),
853
856
                            KShortcut(), "format_font");
854
857
    d->action_format_font->setToolTip(i18n("Change font for selected object"));
855
858
    d->action_format_font->setWhatsThis(i18n("Changes font for selected object."));
954
957
 
955
958
#ifndef KEXI_NO_FEEDBACK_AGENT
956
959
#ifdef FEEDBACK_CLASS
957
 
    action = addAction("help_start_feedback_agent", KIcon("dialog-information"),
 
960
    action = addAction("help_start_feedback_agent", koIcon("dialog-information"),
958
961
                       i18n("Give Feedback..."));
959
962
    connect(action, SIGNAL(triggered()),
960
963
            this, SLOT(slotStartFeedbackAgent()));
1103
1106
 
1104
1107
    acat->addAction("window_previous", Kexi::GlobalActionCategory);
1105
1108
 
 
1109
    acat->addAction("full_screen", Kexi::GlobalActionCategory);
 
1110
 
1106
1111
    //skipped - design view only
1107
1112
    acat->addAction("format_font", Kexi::NoActionCategory);
1108
1113
    acat->addAction("project_save", Kexi::NoActionCategory);
1380
1385
                    i18n("Database project %1 does not appear to have been created using Kexi."
1381
1386
                         "<p>Do you want to import it as a new Kexi project?",
1382
1387
                         projectData.infoString()),
1383
 
                    0, KGuiItem(i18nc("Import Database", "&Import..."), "database_import"),
 
1388
                    0, KGuiItem(i18nc("Import Database", "&Import..."), koIconName("database_import")),
1384
1389
                    KStandardGuiItem::cancel()))
1385
1390
            {
1386
1391
                const bool anotherProjectAlreadyOpened = d->prj;
1411
1416
    d->tabbedToolBar->showTab("data");
1412
1417
    d->tabbedToolBar->showTab("external");
1413
1418
    d->tabbedToolBar->showTab("tools");
1414
 
    d->tabbedToolBar->hideTab("form");//temporalily until createToolbar is splitted
1415
 
    d->tabbedToolBar->hideTab("report");//temporalily until createToolbar is splitted
 
1419
    d->tabbedToolBar->hideTab("form");//temporalily until createToolbar is split
 
1420
    d->tabbedToolBar->hideTab("report");//temporalily until createToolbar is split
1416
1421
    //d->tabbedToolBar->showTab("form");
1417
1422
    //d->tabbedToolBar->showTab("report");
1418
1423
 
2951
2956
    d->nameDialog->widget()->setCaptionText(partItem->caption());
2952
2957
    d->nameDialog->widget()->setNameText(partItem->name());
2953
2958
    d->nameDialog->setWindowTitle(i18n("Save Object As"));
2954
 
    d->nameDialog->setDialogIcon(DesktopIcon(info->itemIcon(), KIconLoader::SizeMedium));
 
2959
    d->nameDialog->setDialogIcon(info->itemIconName());
2955
2960
    allowOverwriting = false;
2956
2961
    bool found;
2957
2962
    do {
2973
2978
                          .subs(d->nameDialog->widget()->nameText()).toString()
2974
2979
                          + "</p><p>" + i18n("Do you want to replace it?") + "</p>",
2975
2980
                          QString(),
2976
 
                          KGuiItem(i18n("&Replace"), "button_yes"),
 
2981
                          KGuiItem(i18n("&Replace"), koIconName("button_yes")),
2977
2982
                          KGuiItem(i18n("&Choose Other Name...")),
2978
2983
                          KStandardGuiItem::cancel(),
2979
2984
                          QString(),
3353
3358
        windowContainer = new KexiWindowContainer(d->mainWidget->tabWidget());
3354
3359
        const int tabIndex = d->mainWidget->tabWidget()->addTab(
3355
3360
            windowContainer,
3356
 
            KIcon(part ? part->info()->itemIcon() : QString()),
 
3361
            KIcon(part ? part->info()->itemIconName() : QString()),
3357
3362
            item->captionOrName());
3358
3363
        d->mainWidget->tabWidget()->setTabToolTip(tabIndex, KexiPart::fullCaptionForItem(*item, part));
3359
3364
        QString whatsThisText;
3541
3546
                             "%1\n"
3542
3547
                             "If you click \"Delete\", you will not be able to undo the deletion.",
3543
3548
                             "</p><p>" + part->info()->instanceCaption() + " \"" + item->name() + "\"?</p>"),
3544
 
                0, KGuiItem(i18n("Delete"), "edit-delete"), KStandardGuiItem::no())) {
 
3549
                0, KGuiItem(i18n("Delete"), koIconName("edit-delete")), KStandardGuiItem::no())) {
3545
3550
            return cancelled;
3546
3551
        }
3547
3552
    }