• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

lokalize

  • sources
  • kde-4.12
  • kdesdk
  • lokalize
  • src
lokalizemainwindow.cpp
Go to the documentation of this file.
1 /* ****************************************************************************
2  This file is part of Lokalize
3 
4  Copyright (C) 2008-2012 by Nick Shaforostoff <shafff@ukr.net>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License as
8  published by the Free Software Foundation; either version 2 of
9  the License or (at your option) version 3 or any later version
10  accepted by the membership of KDE e.V. (or its successor approved
11  by the membership of KDE e.V.), which shall act as a proxy
12  defined in Section 14 of version 3 of the license.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 **************************************************************************** */
23 
24 #include "lokalizemainwindow.h"
25 #include "actionproxy.h"
26 #include "editortab.h"
27 #include "projecttab.h"
28 #include "tmtab.h"
29 #include "jobs.h"
30 #include "filesearchtab.h"
31 #include "prefs_lokalize.h"
32 
33 // #define WEBQUERY_ENABLE
34 
35 #include "project.h"
36 #include "projectmodel.h"
37 #include "projectlocal.h"
38 #include "prefs.h"
39 
40 #include "tools/widgettextcaptureconfig.h"
41 
42 #include "multieditoradaptor.h"
43 
44 #include <kglobal.h>
45 #include <kstandarddirs.h>
46 #include <klocale.h>
47 #include <kicon.h>
48 #include <kmenubar.h>
49 #include <kstatusbar.h>
50 #include <kdebug.h>
51 #include <kmessagebox.h>
52 #include <knotification.h>
53 #include <kapplication.h>
54 
55 
56 #include <kio/netaccess.h>
57 #include <kaction.h>
58 #include <kactioncollection.h>
59 #include <kactioncategory.h>
60 #include <kstandardaction.h>
61 #include <kstandardshortcut.h>
62 #include <krecentfilesaction.h>
63 #include <kxmlguifactory.h>
64 #include <kurl.h>
65 #include <kmenu.h>
66 #include <kfiledialog.h>
67 
68 #include <kross/core/action.h>
69 
70 #include <threadweaver/ThreadWeaver.h>
71 
72 
73 #include <QActionGroup>
74 #include <QMdiArea>
75 #include <QMdiSubWindow>
76 #include <QMenuBar>
77 #include <kdialog.h>
78 
79 
80 
81 LokalizeMainWindow::LokalizeMainWindow()
82  : KXmlGuiWindow()
83  , m_mdiArea(new QMdiArea)
84  , m_prevSubWindow(0)
85  , m_projectSubWindow(0)
86  , m_translationMemorySubWindow(0)
87  , m_editorActions(new QActionGroup(this))
88  , m_managerActions(new QActionGroup(this))
89  , m_spareEditor(new EditorTab(this,false))
90  , m_multiEditorAdaptor(new MultiEditorAdaptor(m_spareEditor))
91  , m_projectScriptingPlugin(0)
92 {
93  m_spareEditor->hide();
94  m_mdiArea->setViewMode(QMdiArea::TabbedView);
95  m_mdiArea->setActivationOrder(QMdiArea::ActivationHistoryOrder);
96  m_mdiArea->setDocumentMode(true);
97 #if QT_VERSION >= 0x040800
98  m_mdiArea->setTabsMovable(true);
99 #endif
100 
101  setCentralWidget(m_mdiArea);
102  connect(m_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)),this,SLOT(slotSubWindowActivated(QMdiSubWindow*)));
103  setupActions();
104 
105  //prevent relayout of dockwidgets
106  m_mdiArea->setOption(QMdiArea::DontMaximizeSubWindowOnActivation,true);
107 
108  connect(Project::instance(), SIGNAL(configChanged()), this, SLOT(projectSettingsChanged()));
109  showProjectOverview();
110 
111  QString tmp=" ";
112  statusBar()->insertItem(tmp,ID_STATUS_CURRENT);
113  statusBar()->insertItem(tmp,ID_STATUS_TOTAL);
114  statusBar()->insertItem(tmp,ID_STATUS_FUZZY);
115  statusBar()->insertItem(tmp,ID_STATUS_UNTRANS);
116  statusBar()->insertItem(tmp,ID_STATUS_ISFUZZY);
117 
118 
119 
120 
121  setAttribute(Qt::WA_DeleteOnClose,true);
122 
123 
124  if (!qApp->isSessionRestored())
125  {
126  KConfig config;
127  KConfigGroup stateGroup(&config,"State");
128  readProperties(stateGroup);
129  }
130 
131  registerDBusAdaptor();
132 
133  QTimer::singleShot(0,this,SLOT(initLater()));
134 }
135 void LokalizeMainWindow::initLater()
136 {
137  if(!m_prevSubWindow && m_projectSubWindow)
138  slotSubWindowActivated(m_projectSubWindow);
139 
140  if(!Project::instance()->isTmSupported())
141  {
142  KNotification* notification=new KNotification("NoSqlModulesAvailable", this);
143  notification->setText( i18nc("@info","No Qt Sql modules were found. Translation memory will not work.") );
144  notification->sendEvent();
145  }
146 }
147 
148 LokalizeMainWindow::~LokalizeMainWindow()
149 {
150  KConfig config;
151  KConfigGroup stateGroup(&config,"State");
152  saveProjectState(stateGroup);
153  m_multiEditorAdaptor->deleteLater();
154 }
155 
156 void LokalizeMainWindow::slotSubWindowActivated(QMdiSubWindow* w)
157 {
158  //QTime aaa;aaa.start();
159  if (!w || m_prevSubWindow==w)
160  return;
161 
162  w->setUpdatesEnabled(true); //QTBUG-23289
163 
164  if (m_prevSubWindow)
165  {
166  m_prevSubWindow->setUpdatesEnabled(false);
167  LokalizeSubwindowBase* prevEditor=static_cast<LokalizeSubwindowBase2*>( m_prevSubWindow->widget() );
168  prevEditor->hideDocks();
169  guiFactory()->removeClient( prevEditor->guiClient() );
170  prevEditor->statusBarItems.unregisterStatusBar();
171 
172  if (qobject_cast<EditorTab*>(prevEditor))
173  {
174  EditorTab* w=static_cast<EditorTab*>( prevEditor );
175  EditorState state=w->state();
176  m_lastEditorState=state.dockWidgets.toBase64();
177  }
178  /*
179 
180  KMenu* projectActions=static_cast<KMenu*>(factory()->container("project_actions",this));
181  QList<QAction*> actionz=projectActions->actions();
182 
183  int i=actionz.size();
184  //projectActions->menuAction()->setVisible(i);
185  //kWarning()<<"adding object"<<actionz.at(0);
186  while(--i>=0)
187  {
188  disconnect(w, SIGNAL(signalNewEntryDisplayed()),actionz.at(i),SLOT(signalNewEntryDisplayed()));
189  //static_cast<Kross::Action*>(actionz.at(i))->addObject(static_cast<EditorWindow*>( editor )->adaptor(),"Editor",Kross::ChildrenInterface::AutoConnectSignals);
190  //static_cast<Kross::Action*>(actionz.at(i))->trigger();
191  }
192  }
193 */
194  }
195  LokalizeSubwindowBase* editor=static_cast<LokalizeSubwindowBase2*>( w->widget() );
196  if (qobject_cast<EditorTab*>(editor))
197  {
198  EditorTab* w=static_cast<EditorTab*>( editor );
199  w->setProperFocus();
200 
201  EditorState state=w->state();
202  m_lastEditorState=state.dockWidgets.toBase64();
203 
204  m_multiEditorAdaptor->setEditorTab(w);
205 // connect(m_multiEditorAdaptor,SIGNAL(srcFileOpenRequested(QString,int)),this,SLOT(showTM()));
206 /*
207  KMenu* projectActions=static_cast<KMenu*>(factory()->container("project_actions",this));
208  QList<QAction*> actionz=projectActions->actions();
209 
210  int i=actionz.size();
211  //projectActions->menuAction()->setVisible(i);
212  //kWarning()<<"adding object"<<actionz.at(0);
213  while(--i>=0)
214  {
215  connect(w, SIGNAL(signalNewEntryDisplayed()),actionz.at(i),SLOT(signalNewEntryDisplayed()));
216  //static_cast<Kross::Action*>(actionz.at(i))->addObject(static_cast<EditorWindow*>( editor )->adaptor(),"Editor",Kross::ChildrenInterface::AutoConnectSignals);
217  //static_cast<Kross::Action*>(actionz.at(i))->trigger();
218  }*/
219 
220  QTabBar* tw = m_mdiArea->findChild<QTabBar*>();
221  if(tw) tw->setTabToolTip(tw->currentIndex(), w->currentUrl().toLocalFile());
222 
223  emit editorActivated();
224  }
225  else if (w==m_projectSubWindow && m_projectSubWindow)
226  {
227  QTabBar* tw = m_mdiArea->findChild<QTabBar*>();
228  if(tw) tw->setTabToolTip(tw->currentIndex(), Project::instance()->path());
229  }
230 
231  editor->showDocks();
232  editor->statusBarItems.registerStatusBar(statusBar());
233  guiFactory()->addClient( editor->guiClient() );
234 
235  m_prevSubWindow=w;
236 
237  //kWarning()<<"finished"<<aaa.elapsed();
238 }
239 
240 
241 bool LokalizeMainWindow::queryClose()
242 {
243  QList<QMdiSubWindow*> editors=m_mdiArea->subWindowList();
244  int i=editors.size();
245  while (--i>=0)
246  {
247  //if (editors.at(i)==m_projectSubWindow)
248  if (!qobject_cast<EditorTab*>(editors.at(i)->widget()))
249  continue;
250  if (!static_cast<EditorTab*>( editors.at(i)->widget() )->queryClose())
251  return false;
252  }
253 
254  bool ok=Project::instance()->queryCloseForAuxiliaryWindows();
255 
256  if (ok)
257  {
258  TM::cancelAllJobs(); //this shit works l)
259  Project::instance()->model()->weaver()->dequeue();
260  }
261  return ok;
262 }
263 
264 EditorTab* LokalizeMainWindow::fileOpen(KUrl url, int entry, bool setAsActive, const QString& mergeFile, bool silent)
265 {
266  if (!url.isEmpty()&&m_fileToEditor.contains(url)&&m_fileToEditor.value(url))
267  {
268  kWarning()<<"already opened";
269  QMdiSubWindow* sw=m_fileToEditor.value(url);
270  m_mdiArea->setActiveSubWindow(sw);
271  return static_cast<EditorTab*>(sw->widget());
272  }
273 
274  QByteArray state=m_lastEditorState;
275  EditorTab* w=new EditorTab(this);
276  QMdiSubWindow* sw=0;
277  if (!url.isEmpty())//create QMdiSubWindow BEFORE fileOpen() because it causes some strange QMdiArea behaviour otherwise
278  sw=m_mdiArea->addSubWindow(w);
279 
280  KUrl baseUrl;
281  QMdiSubWindow* activeSW=m_mdiArea->currentSubWindow();
282  if (activeSW && qobject_cast<LokalizeSubwindowBase*>(activeSW->widget()))
283  baseUrl=static_cast<LokalizeSubwindowBase*>(activeSW->widget())->currentUrl();
284 
285  if (!w->fileOpen(url,baseUrl,silent))
286  {
287  if (sw)
288  {
289  m_mdiArea->removeSubWindow(sw);
290  sw->deleteLater();
291  }
292  w->deleteLater();
293  return 0;
294  }
295 
296  if (!sw)
297  sw=m_mdiArea->addSubWindow(w);
298  w->showMaximized();
299  sw->showMaximized();
300 
301  if (!state.isEmpty())
302  w->restoreState(QByteArray::fromBase64(state));
303 
304  if (entry/* || offset*/)
305  w->gotoEntry(DocPosition(entry/*, DocPosition::Target, 0, offset*/));
306  if (setAsActive)
307  {
308  m_toBeActiveSubWindow=sw;
309  QTimer::singleShot(0,this,SLOT(applyToBeActiveSubWindow()));
310  }
311  else
312  sw->setUpdatesEnabled(false); //QTBUG-23289
313 
314  if (!mergeFile.isEmpty())
315  w->mergeOpen(mergeFile);
316 
317  m_openRecentFileAction->addUrl(w->currentUrl());
318  connect(sw, SIGNAL(destroyed(QObject*)),this,SLOT(editorClosed(QObject*)));
319  connect(w, SIGNAL(aboutToBeClosed()),this,SLOT(resetMultiEditorAdaptor()));
320  connect(w, SIGNAL(fileOpenRequested(KUrl,QString,QString)),this,SLOT(fileOpen(KUrl,QString,QString)));
321  connect(w, SIGNAL(tmLookupRequested(QString,QString)),this,SLOT(lookupInTranslationMemory(QString,QString)));
322 
323  QString fn=url.fileName();
324  FileToEditor::const_iterator i = m_fileToEditor.constBegin();
325  while (i != m_fileToEditor.constEnd())
326  {
327  if (i.key().fileName()==fn)
328  {
329  static_cast<EditorTab*>(i.value()->widget())->setFullPathShown(true);
330  w->setFullPathShown(true);
331  }
332  ++i;
333  }
334  m_fileToEditor.insert(w->currentUrl(),sw);
335 
336  sw->setAttribute(Qt::WA_DeleteOnClose,true);
337  emit editorAdded();
338  return w;
339 }
340 
341 void LokalizeMainWindow::resetMultiEditorAdaptor()
342 {
343  m_multiEditorAdaptor->setEditorTab(m_spareEditor); //it will be reparented shortly if there are other editors
344 }
345 
346 void LokalizeMainWindow::editorClosed(QObject* obj)
347 {
348  m_fileToEditor.remove(m_fileToEditor.key(static_cast<QMdiSubWindow*>(obj)));
349 }
350 
351 EditorTab* LokalizeMainWindow::fileOpen(const KUrl& url, const QString& source, const QString& ctxt)
352 {
353  EditorTab* w=fileOpen(url, 0, true);
354  if (!w)
355  return 0;//TODO message
356  w->findEntryBySourceContext(source,ctxt);
357  return w;
358 }
359 
360 EditorTab* LokalizeMainWindow::fileOpen(const KUrl& url, DocPosition docPos, int selection)
361 {
362  EditorTab* w=fileOpen(url, 0, true);
363  if (!w)
364  return 0;//TODO message
365  w->gotoEntry(docPos, selection);
366  return w;
367 }
368 
369 QObject* LokalizeMainWindow::projectOverview()
370 {
371  if (!m_projectSubWindow)
372  {
373  ProjectTab* w=new ProjectTab(this);
374  m_projectSubWindow=m_mdiArea->addSubWindow(w);
375  w->showMaximized();
376  m_projectSubWindow->showMaximized();
377  connect(w, SIGNAL(fileOpenRequested(KUrl)),this,SLOT(fileOpen(KUrl)));
378  connect(w, SIGNAL(projectOpenRequested(QString)),this,SLOT(openProject(QString)));
379  connect(w, SIGNAL(searchRequested(QStringList)),this,SLOT(addFilesToSearch(QStringList)));
380  }
381  if (m_mdiArea->currentSubWindow()==m_projectSubWindow)
382  return m_projectSubWindow->widget();
383  return 0;
384 }
385 
386 void LokalizeMainWindow::showProjectOverview()
387 {
388  projectOverview();
389  m_mdiArea->setActiveSubWindow(m_projectSubWindow);
390 }
391 
392 TM::TMTab* LokalizeMainWindow::showTM()
393 {
394  if (!Project::instance()->isTmSupported())
395  {
396  KMessageBox::information(0, i18n("TM facility requires SQLite Qt module."), i18n("No SQLite module available"));
397  return 0;
398  }
399 
400  if (!m_translationMemorySubWindow)
401  {
402  TM::TMTab* w=new TM::TMTab(this);
403  m_translationMemorySubWindow=m_mdiArea->addSubWindow(w);
404  w->showMaximized();
405  m_translationMemorySubWindow->showMaximized();
406  connect(w, SIGNAL(fileOpenRequested(KUrl,QString,QString)),this,SLOT(fileOpen(KUrl,QString,QString)));
407  }
408 
409  m_mdiArea->setActiveSubWindow(m_translationMemorySubWindow);
410  return static_cast<TM::TMTab*>(m_translationMemorySubWindow->widget());
411 }
412 
413 FileSearchTab* LokalizeMainWindow::showFileSearch(bool activate)
414 {
415  if (!m_fileSearchSubWindow)
416  {
417  FileSearchTab* w=new FileSearchTab(this);
418  m_fileSearchSubWindow=m_mdiArea->addSubWindow(w);
419  w->showMaximized();
420  m_fileSearchSubWindow->showMaximized();
421  connect(w, SIGNAL(fileOpenRequested(KUrl,DocPosition,int)),this,SLOT(fileOpen(KUrl,DocPosition,int)));
422  }
423 
424  if (activate)
425  m_mdiArea->setActiveSubWindow(m_fileSearchSubWindow);
426  return static_cast<FileSearchTab*>(m_fileSearchSubWindow->widget());
427 }
428 
429 void LokalizeMainWindow::fileSearchNext()
430 {
431  FileSearchTab* w=showFileSearch(/*activate=*/false);
432  //TODO fill search params based on current selection
433  w->fileSearchNext();
434 }
435 
436 void LokalizeMainWindow::addFilesToSearch(const QStringList& files)
437 {
438  FileSearchTab* w=showFileSearch();
439  w->addFilesToSearch(files);
440 }
441 
442 
443 void LokalizeMainWindow::applyToBeActiveSubWindow()
444 {
445  m_mdiArea->setActiveSubWindow(m_toBeActiveSubWindow);
446 }
447 
448 
449 void LokalizeMainWindow::setupActions()
450 {
451  //all operations that can be done after initial setup
452  //(via QTimer::singleShot) go to initLater()
453 
454  QTime aaa;aaa.start();
455 
456  setStandardToolBarMenuEnabled(true);
457 
458  KAction *action;
459  KActionCollection* ac=actionCollection();
460  KActionCategory* actionCategory;
461  KActionCategory* file=new KActionCategory(i18nc("@title actions category","File"), ac);
462  //KActionCategory* config=new KActionCategory(i18nc("@title actions category","Configuration"), ac);
463  KActionCategory* glossary=new KActionCategory(i18nc("@title actions category","Glossary"), ac);
464  KActionCategory* tm=new KActionCategory(i18nc("@title actions category","Translation Memory"), ac);
465  KActionCategory* proj=new KActionCategory(i18nc("@title actions category","Project"), ac);
466 
467  actionCategory=file;
468 
469 // File
470  //KStandardAction::open(this, SLOT(fileOpen()), ac);
471  file->addAction(KStandardAction::Open,this, SLOT(fileOpen()));
472  m_openRecentFileAction = KStandardAction::openRecent(this,SLOT(fileOpen(KUrl)),ac);
473 
474  file->addAction(KStandardAction::Quit,KApplication::kApplication(), SLOT(closeAllWindows()));
475 
476 
477 //Settings
478  SettingsController* sc=SettingsController::instance();
479  KStandardAction::preferences(sc, SLOT(showSettingsDialog()),ac);
480 
481 #define ADD_ACTION_ICON(_name,_text,_shortcut,_icon)\
482  action = actionCategory->addAction(_name);\
483  action->setText(_text);\
484  action->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::_shortcut));\
485  action->setIcon(KIcon(_icon));
486 
487 #define ADD_ACTION_SHORTCUT_ICON(_name,_text,_shortcut,_icon)\
488  action = actionCategory->addAction(_name);\
489  action->setText(_text);\
490  action->setShortcut(QKeySequence( _shortcut ));\
491  action->setIcon(KIcon(_icon));
492 
493 #define ADD_ACTION_SHORTCUT(_name,_text,_shortcut)\
494  action = actionCategory->addAction(_name);\
495  action->setShortcut(QKeySequence( _shortcut ));\
496  action->setText(_text);
497 
498 
499 //Window
500  //documentBack
501  //KStandardAction::close(m_mdiArea, SLOT(closeActiveSubWindow()), ac);
502 
503  actionCategory=file;
504  ADD_ACTION_SHORTCUT("next-tab",i18n("Next tab"),Qt::CTRL+Qt::Key_BracketRight)
505  connect(action,SIGNAL(triggered()),m_mdiArea,SLOT(activateNextSubWindow()));
506 
507  ADD_ACTION_SHORTCUT("prev-tab",i18n("Previous tab"),Qt::CTRL+Qt::Key_BracketLeft)
508  connect(action,SIGNAL(triggered()),m_mdiArea,SLOT(activatePreviousSubWindow()));
509 
510 //Tools
511  actionCategory=glossary;
512  Project* project=Project::instance();
513  ADD_ACTION_SHORTCUT("tools_glossary",i18nc("@action:inmenu","Glossary"),Qt::CTRL+Qt::ALT+Qt::Key_G)
514  connect(action,SIGNAL(triggered()),project,SLOT(showGlossary()));
515 
516  actionCategory=tm;
517  ADD_ACTION_SHORTCUT("tools_tm",i18nc("@action:inmenu","Translation memory"),Qt::Key_F7)
518  connect(action,SIGNAL(triggered()),this,SLOT(showTM()));
519 
520  action = tm->addAction("tools_tm_manage",project,SLOT(showTMManager()));
521  action->setText(i18nc("@action:inmenu","Manage translation memories"));
522 
523 //Project
524  actionCategory=proj;
525  ADD_ACTION_SHORTCUT("project_overview",i18nc("@action:inmenu","Project overview"),Qt::Key_F4)
526  connect(action,SIGNAL(triggered()),this,SLOT(showProjectOverview()));
527 
528  action = proj->addAction("project_configure",sc,SLOT(projectConfigure()));
529  action->setText(i18nc("@action:inmenu","Configure project"));
530 
531  action = proj->addAction("project_create",sc,SLOT(projectCreate()));
532  action->setText(i18nc("@action:inmenu","Create new project"));
533 
534  action = proj->addAction("project_open",this,SLOT(openProject()));
535  action->setText(i18nc("@action:inmenu","Open project"));
536  action->setIcon(KIcon("project-open"));
537 
538  m_openRecentProjectAction=new KRecentFilesAction(i18nc("@action:inmenu","Open recent project"),this);
539  action = proj->addAction("project_open_recent",m_openRecentProjectAction);
540  connect(m_openRecentProjectAction,SIGNAL(urlSelected(KUrl)),this,SLOT(openProject(KUrl)));
541 
542  //Qt::QueuedConnection: defer until event loop is running to eliminate QWidgetPrivate::showChildren(bool) startup crash
543  connect(Project::instance(),SIGNAL(loaded()), this,SLOT(projectLoaded()), Qt::QueuedConnection);
544 
545 
546  ADD_ACTION_SHORTCUT("tools_filesearch",i18nc("@action:inmenu","Search and replace in files"),Qt::Key_F6)
547  connect(action,SIGNAL(triggered()),this,SLOT(showFileSearch()));
548 
549  ADD_ACTION_SHORTCUT("tools_filesearch_next",i18nc("@action:inmenu","Find next in files"),Qt::META+Qt::Key_F3)
550  connect(action,SIGNAL(triggered()),this,SLOT(fileSearchNext()));
551 
552  action = ac->addAction("tools_widgettextcapture",this,SLOT(widgetTextCapture()));
553  action->setText(i18nc("@action:inmenu","Widget text capture"));
554 
555  setupGUI(Default,"lokalizemainwindowui.rc");
556 
557  kWarning()<<"finished"<<aaa.elapsed();
558 }
559 
560 bool LokalizeMainWindow::closeProject()
561 {
562  if (!queryClose())
563  return false;
564 
565  KConfigGroup emptyGroup; //don't save which project to reopen
566  saveProjectState(emptyGroup);
567  //close files from previous project
568  foreach (QMdiSubWindow* subwindow, m_mdiArea->subWindowList())
569  {
570  if (subwindow==m_translationMemorySubWindow && m_translationMemorySubWindow)
571  subwindow->deleteLater();
572  else if (qobject_cast<EditorTab*>(subwindow->widget()))
573  {
574  m_fileToEditor.remove(static_cast<EditorTab*>(subwindow->widget())->currentUrl());//safety
575  m_mdiArea->removeSubWindow(subwindow);
576  subwindow->deleteLater();
577  }
578  }
579  Project::instance()->load(QString());
580  //TODO scripts
581  return true;
582 }
583 
584 void LokalizeMainWindow::openProject(QString path)
585 {
586  path=SettingsController::instance()->projectOpen(path, false);//dry run
587 
588  if (path.isEmpty())
589  return;
590 
591  if (closeProject())
592  SettingsController::instance()->projectOpen(path, true);//really open
593 }
594 
595 void LokalizeMainWindow::saveProperties(KConfigGroup& stateGroup)
596 {
597  saveProjectState(stateGroup);
598 }
599 
600 void LokalizeMainWindow::saveProjectState(KConfigGroup& stateGroup)
601 {
602  QList<QMdiSubWindow*> editors=m_mdiArea->subWindowList();
603 
604  QStringList files;
605  QStringList mergeFiles;
606  QList<QByteArray> dockWidgets;
607  //QList<int> offsets;
608  QList<int> entries;
609  QMdiSubWindow* activeSW=m_mdiArea->currentSubWindow();
610  int activeSWIndex=-1;
611  int i=editors.size();
612  while (--i>=0)
613  {
614  //if (editors.at(i)==m_projectSubWindow)
615  if (!editors.at(i) || !qobject_cast<EditorTab*>(editors.at(i)->widget()))
616  continue;
617  if (editors.at(i)==activeSW)
618  activeSWIndex=files.size();
619  EditorState state=static_cast<EditorTab*>( editors.at(i)->widget() )->state();
620  files.append(state.url.pathOrUrl());
621  mergeFiles.append(state.mergeUrl.pathOrUrl());
622  dockWidgets.append(state.dockWidgets.toBase64());
623  entries.append(state.entry);
624  //offsets.append(state.offset);
625  //kWarning()<<static_cast<EditorWindow*>(editors.at(i)->widget() )->state().url;
626  }
627  //if (activeSWIndex==-1 && activeSW==m_projectSubWindow)
628 
629  if (files.size() == 0 && !m_lastEditorState.isEmpty())
630  dockWidgets.append(m_lastEditorState); // save last state if no editor open
631 
632  if (stateGroup.isValid())
633  stateGroup.writeEntry("Project",Project::instance()->path());
634 
635 
636  KConfig config;
637  KConfigGroup projectStateGroup(&config,"State-"+Project::instance()->path());
638  projectStateGroup.writeEntry("Active",activeSWIndex);
639  projectStateGroup.writeEntry("Files",files);
640  projectStateGroup.writeEntry("MergeFiles",mergeFiles);
641  projectStateGroup.writeEntry("DockWidgets",dockWidgets);
642  //stateGroup.writeEntry("Offsets",offsets);
643  projectStateGroup.writeEntry("Entries",entries);
644  if (m_projectSubWindow)
645  {
646  ProjectTab *w = static_cast<ProjectTab*>(m_projectSubWindow->widget());
647  if (w->unitsCount()>0)
648  projectStateGroup.writeEntry("UnitsCount", w->unitsCount());
649  }
650 
651 
652  QString nameSpecifier=Project::instance()->path();
653  if (!nameSpecifier.isEmpty()) nameSpecifier.prepend('-');
654  KConfig* c=stateGroup.isValid()?stateGroup.config():&config;
655  m_openRecentFileAction->saveEntries(KConfigGroup(c,"RecentFiles"+nameSpecifier));
656 
657  m_openRecentProjectAction->saveEntries(KConfigGroup(&config,"RecentProjects"));
658 }
659 
660 void LokalizeMainWindow::readProperties(const KConfigGroup& stateGroup)
661 {
662  KConfig config;
663  const KConfig* c=stateGroup.isValid()?stateGroup.config():&config;
664  m_openRecentProjectAction->loadEntries(KConfigGroup(c,"RecentProjects"));
665 
666  QString path=stateGroup.readEntry("Project",QString());
667  if (Project::instance()->isLoaded() || path.isEmpty())
668  {
669  //1. we weren't existing yet when the signal was emitted
670  //2. defer until event loop is running to eliminate QWidgetPrivate::showChildren(bool) startup crash
671  QTimer::singleShot(0, this, SLOT(projectLoaded()));
672  }
673  else
674  Project::instance()->load(path);
675 }
676 
677 void LokalizeMainWindow::projectLoaded()
678 {
679  QString projectPath=Project::instance()->path();
680  kDebug()<<projectPath;
681  m_openRecentProjectAction->addUrl( KUrl::fromPath(projectPath) );
682 
683  KConfig config;
684 
685  QString nameSpecifier=projectPath;
686  if (!nameSpecifier.isEmpty()) nameSpecifier.prepend('-');
687  m_openRecentFileAction->loadEntries(KConfigGroup(&config,"RecentFiles"+nameSpecifier));
688 
689 
690  //if project isn't loaded, still restore opened files from "State-"
691  KConfigGroup projectStateGroup(&config,"State-"+projectPath);
692 
693  QStringList files;
694  QStringList mergeFiles;
695  QList<QByteArray> dockWidgets;
696  //QList<int> offsets;
697  QList<int> entries;
698 
699  if (m_projectSubWindow)
700  {
701  ProjectTab *w = static_cast<ProjectTab*>(m_projectSubWindow->widget());
702  w->setLegacyUnitsCount(projectStateGroup.readEntry("UnitsCount", 0));
703 
704  QTabBar* tw = m_mdiArea->findChild<QTabBar*>();
705  if(tw) for(int i=0;i<tw->count();i++)
706  if (tw->tabText(i)==w->windowTitle())
707  tw->setTabToolTip(i, Project::instance()->path());
708  }
709 
710  entries=projectStateGroup.readEntry("Entries",entries);
711 
712  files=projectStateGroup.readEntry("Files",files);
713  mergeFiles=projectStateGroup.readEntry("MergeFiles",mergeFiles);
714  dockWidgets=projectStateGroup.readEntry("DockWidgets",dockWidgets);
715  int i=files.size();
716  int activeSWIndex=projectStateGroup.readEntry("Active",-1);
717  QStringList failedFiles;
718  while (--i>=0)
719  {
720  if (i<dockWidgets.size())
721  m_lastEditorState=dockWidgets.at(i);
722  if (!fileOpen(files.at(i), entries.at(i)/*, offsets.at(i)*//*,&activeSW11*/,activeSWIndex==i,mergeFiles.at(i),/*silent*/true))
723  failedFiles.append(files.at(i));
724  }
725  if (!failedFiles.isEmpty())
726  {
727  kDebug()<<"failedFiles"<<failedFiles;
728 // KMessageBox::error(this, i18nc("@info","Error opening the following files:")+
729 // "<br><il><li><filename>"+failedFiles.join("</filename></li><li><filename>")+"</filename></li></il>" );
730  KNotification* notification=new KNotification("FilesOpenError", this);
731  notification->setText( i18nc("@info","Error opening the following files:\n\n")%"<filename>"%failedFiles.join("</filename><br><filename>")%"</filename>" );
732  notification->sendEvent();
733  }
734 
735  if (files.isEmpty() && dockWidgets.size() > 0)
736  m_lastEditorState=dockWidgets.first(); // restore last state if no editor open
737 
738  if (activeSWIndex==-1)
739  {
740  m_toBeActiveSubWindow=m_projectSubWindow;
741  QTimer::singleShot(0,this,SLOT(applyToBeActiveSubWindow()));
742  }
743 
744  projectSettingsChanged();
745 
746  QTimer::singleShot(0,this,SLOT(loadProjectScripts()));
747 }
748 
749 void LokalizeMainWindow::projectSettingsChanged()
750 {
751  //TODO show langs
752  setCaption(Project::instance()->projectID());
753 }
754 
755 void LokalizeMainWindow::widgetTextCapture()
756 {
757  WidgetTextCaptureConfig* w=new WidgetTextCaptureConfig(this);
758  w->show();
759 }
760 
761 
762 //BEGIN DBus interface
763 
764 //#include "plugin.h"
765 #include "mainwindowadaptor.h"
766 #include <kross/core/actioncollection.h>
767 #include <kross/core/manager.h>
768 
769 using namespace Kross;
770 
771 class MyScriptingPlugin: public Kross::ScriptingPlugin
772 {
773 public:
774  MyScriptingPlugin(QObject* lokalize,QObject* editor)
775  : Kross::ScriptingPlugin(lokalize)
776  {
777  addObject(lokalize,"Lokalize");
778  addObject(Project::instance(),"Project");
779  addObject(editor,"Editor");
780  setXMLFile("scriptsui.rc",true);
781  }
782  ~MyScriptingPlugin(){}
783 };
784 
785 #define PROJECTRCFILE "scripts.rc"
786 #define PROJECTRCFILEDIR Project::instance()->projectDir()+"/lokalize-scripts"
787 #define PROJECTRCFILEPATH Project::instance()->projectDir()+"/lokalize-scripts" "/" PROJECTRCFILE
788 //TODO be lazy creating scripts dir
789 ProjectScriptingPlugin::ProjectScriptingPlugin(QObject* lokalize, QObject* editor)
790  : Kross::ScriptingPlugin(Project::instance()->kind(),
791  PROJECTRCFILEPATH,
792  Project::instance()->kind(), lokalize)
793 {
794  if (Project::instance()->projectDir().isEmpty())
795  return;
796 
797  QString filepath=PROJECTRCFILEPATH;
798  if (!QFile::exists(filepath))
799  {
800  KUrl dir = KUrl(filepath).directory();
801  KIO::NetAccess::mkdir(dir, 0);
802  QFile f(filepath);
803  f.open(QIODevice::WriteOnly);
804  QTextStream out(&f);
805  out <<"<!-- see help for the syntax -->";
806  f.close();
807  }
808 
809  //kWarning()<<Kross::Manager::self().hasInterpreterInfo("python");
810  addObject(lokalize,"Lokalize",ChildrenInterface::AutoConnectSignals);
811  addObject(Project::instance(),"Project",ChildrenInterface::AutoConnectSignals);
812  addObject(editor,"Editor",ChildrenInterface::AutoConnectSignals);
813  setXMLFile("scriptsui.rc",true);
814 }
815 
816 void ProjectScriptingPlugin::setDOMDocument (const QDomDocument &document, bool merge)
817 {
818  Kross::ScriptingPlugin::setDOMDocument(document, merge);
819  QTimer::singleShot(0,this, SLOT(doAutoruns()));
820 }
821 
822 void ProjectScriptingPlugin::doAutoruns()
823 {
824  Kross::ActionCollection* collection=Kross::Manager::self().actionCollection()->collection(Project::instance()->kind());
825  if (!collection) return;
826  foreach(const QString &collectionname, collection->collections())
827  {
828  Kross::ActionCollection* c = collection->collection(collectionname);
829  if(!c->isEnabled()) continue;
830 
831  foreach(Kross::Action* action, c->actions())
832  {
833  if (action->property("autorun").toBool())
834  action->trigger();
835  if (action->property("first-run").toBool() && Project::local()->firstRun())
836  action->trigger();
837  }
838  }
839 }
840 
841 ProjectScriptingPlugin::~ProjectScriptingPlugin()
842 {
843  Kross::ActionCollection* collection=Kross::Manager::self().actionCollection()->collection(Project::instance()->kind());
844  if (!collection) return;
845 
846  QString scriptsrc=PROJECTRCFILE;
847  QDir rcdir(PROJECTRCFILEDIR);
848  kWarning()<<rcdir.entryList(QStringList("*.rc"),QDir::Files);
849  foreach(const QString& rc, QDir(PROJECTRCFILEDIR).entryList(QStringList("*.rc"),QDir::Files))
850  if (rc!=scriptsrc)
851  kWarning()<<rc<<collection->readXmlFile(rcdir.absoluteFilePath(rc));
852 }
853 
854 /*
855 void LokalizeMainWindow::checkForProjectAlreadyOpened()
856 {
857 
858  QStringList services=QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
859  int i=services.size();
860  while(--i>=0)
861  {
862  if (services.at(i).startsWith("org.kde.lokalize"))
863  //QDBusReply<uint> QDBusConnectionInterface::servicePid ( const QString & serviceName ) const;
864  QDBusConnection::callWithCallback(QDBusMessage::createMethodCall(services.at(i),"/ThisIsWhatYouWant","org.kde.Lokalize.MainWindow","currentProject"),
865  this, SLOT(), const char * errorMethod);
866  }
867 
868 }
869 */
870 
871 void LokalizeMainWindow::registerDBusAdaptor()
872 {
873  new MainWindowAdaptor(this);
874  QDBusConnection::sessionBus().registerObject("/ThisIsWhatYouWant", this);
875  QDBusConnection::sessionBus().unregisterObject("/KDebug",QDBusConnection::UnregisterTree);
876 
877  //kWarning()<<QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
878 #ifndef Q_WS_MAC
879  //TODO really fix!!!
880  guiFactory()->addClient(new MyScriptingPlugin(this,m_multiEditorAdaptor));
881 #endif
882 
883  //KMenu* projectActions=static_cast<KMenu*>(factory()->container("project_actions",this));
884 
885 /*
886  KActionCollection* actionCollection = mWindow->actionCollection();
887  actionCollection->action("file_save")->setEnabled(canSave);
888  actionCollection->action("file_save_as")->setEnabled(canSave);
889 */
890 }
891 
892 void LokalizeMainWindow::loadProjectScripts()
893 {
894  qWarning()<<"loadProjectScripts() 1111"<<Project::instance()->poDir();
895  if (m_projectScriptingPlugin)
896  {
897  qWarning()<<"loadProjectScripts() 222";
898  guiFactory()->removeClient(m_projectScriptingPlugin);
899  delete m_projectScriptingPlugin;
900  }
901 
902  qWarning()<<"loadProjectScripts() 333";
903  //a HACK to get new .rc files shown w/o requiring a restart
904  m_projectScriptingPlugin=new ProjectScriptingPlugin(this,m_multiEditorAdaptor);
905 
906  //guiFactory()->addClient(m_projectScriptingPlugin);
907  //guiFactory()->removeClient(m_projectScriptingPlugin);
908 
909  delete m_projectScriptingPlugin;
910  qWarning()<<"loadProjectScripts() 444";
911  m_projectScriptingPlugin=new ProjectScriptingPlugin(this,m_multiEditorAdaptor);
912  qWarning()<<"loadProjectScripts() 555";
913  guiFactory()->addClient(m_projectScriptingPlugin);
914  qWarning()<<"loadProjectScripts() 666";
915 }
916 
917 int LokalizeMainWindow::lookupInTranslationMemory(DocPosition::Part part, const QString& text)
918 {
919  TM::TMTab* w=showTM();
920  if (!text.isEmpty())
921  w->lookup(part==DocPosition::Source?text:QString(),part==DocPosition::Target?text:QString());
922  return w->dbusId();
923 }
924 
925 int LokalizeMainWindow::lookupInTranslationMemory(const QString& source, const QString& target)
926 {
927  TM::TMTab* w=showTM();
928  w->lookup(source, target);
929  return w->dbusId();
930 }
931 
932 
933 int LokalizeMainWindow::showTranslationMemory()
934 {
935  /*activateWindow();
936  raise();
937  show();*/
938  return lookupInTranslationMemory(DocPosition::UndefPart,QString());
939 }
940 
941 int LokalizeMainWindow::openFileInEditorAt(const QString& path, const QString& source, const QString& ctxt)
942 {
943  EditorTab* w=fileOpen(KUrl(path),source,ctxt);
944  if (!w) return -1;
945  return w->dbusId();
946 }
947 
948 int LokalizeMainWindow::openFileInEditor(const QString& path)
949 {
950  return openFileInEditorAt(path,QString(),QString());
951 }
952 
953 QObject* LokalizeMainWindow::activeEditor()
954 {
955  QList<QMdiSubWindow*> editors=m_mdiArea->subWindowList();
956  QMdiSubWindow* activeSW=m_mdiArea->currentSubWindow();
957  if (!activeSW || !qobject_cast<EditorTab*>(activeSW->widget()))
958  return 0;
959  return activeSW->widget();
960 }
961 
962 QObject* LokalizeMainWindow::editorForFile(const QString& path)
963 {
964  if (!m_fileToEditor.contains(KUrl(path))) return 0;
965  QMdiSubWindow* w=m_fileToEditor.value(KUrl(path));
966  if (!w) return 0;
967  return static_cast<EditorTab*>(w->widget());
968 }
969 
970 int LokalizeMainWindow::editorIndexForFile(const QString& path)
971 {
972  EditorTab* editor=static_cast<EditorTab*>(editorForFile(path));
973  if (!editor) return -1;
974  return editor->dbusId();
975 }
976 
977 
978 QString LokalizeMainWindow::currentProject(){return Project::instance()->path();}
979 
980 #include <unistd.h>
981 int LokalizeMainWindow::pid(){return getpid();}
982 QString LokalizeMainWindow::dbusName(){return QString("org.kde.lokalize-%1").arg(pid());}
983 void LokalizeMainWindow::busyCursor(bool busy){busy?QApplication::setOverrideCursor(Qt::WaitCursor):QApplication::restoreOverrideCursor();}
984 // void LokalizeMainWindow::processEvents(){QCoreApplication::processEvents();}
985 
986 
987 MultiEditorAdaptor::MultiEditorAdaptor(EditorTab *parent)
988  : EditorAdaptor(parent)
989 {
990  setObjectName("MultiEditorAdaptor");
991  connect(parent,SIGNAL(destroyed(QObject*)),this,SLOT(handleParentDestroy(QObject*)));
992 }
993 
994 void MultiEditorAdaptor::setEditorTab(EditorTab* e)
995 {
996  if (parent())
997  disconnect(parent(),SIGNAL(destroyed(QObject*)),this,SLOT(handleParentDestroy(QObject*)));
998  if (e)
999  connect(e,SIGNAL(destroyed(QObject*)),this,SLOT(handleParentDestroy(QObject*)));
1000  setParent(e);
1001  setAutoRelaySignals(false);
1002  setAutoRelaySignals(true);
1003 }
1004 
1005 void MultiEditorAdaptor::handleParentDestroy(QObject* p)
1006 {
1007  Q_UNUSED(p);
1008  kWarning()<<"avoiding destroying m_multiEditorAdaptor";
1009  setParent(0);
1010 }
1011 
1012 //END DBus interface
1013 
1014 
1015 
1016 DelayedFileOpener::DelayedFileOpener(const KUrl::List& urls, LokalizeMainWindow* lmw)
1017  : QObject()
1018  , m_urls(urls)
1019  , m_lmw(lmw)
1020 {
1021  //do the work just after project load handlind is finished
1022  //(i.e. all the files from previous project session are loaded)
1023  QTimer::singleShot(1,this,SLOT(doOpen()));
1024 }
1025 
1026 void DelayedFileOpener::doOpen()
1027 {
1028  int lastIndex=m_urls.count()-1;
1029  for (int i=0;i<=lastIndex;i++)
1030  m_lmw->fileOpen(m_urls.at(i), 0, /*set as active*/i==lastIndex);
1031  deleteLater();
1032 }
1033 
1034 
1035 #include "lokalizemainwindow.moc"
1036  //these have to be included somewhere ;)
1037 #include "lokalizesubwindowbase.moc"
1038 #include "multieditoradaptor.moc"
project.h
PROJECTRCFILEPATH
#define PROJECTRCFILEPATH
Definition: lokalizemainwindow.cpp:787
ProjectModel::weaver
ThreadWeaver::Weaver * weaver()
Definition: projectmodel.h:167
EditorTab::mergeOpen
void mergeOpen(KUrl url=KUrl())
Definition: editortab.cpp:1315
filesearchtab.h
StatusBarProxy::registerStatusBar
void registerStatusBar(KStatusBar *)
Definition: actionproxy.cpp:104
DocPosition::Target
Definition: pos.h:44
TM::cancelAllJobs
void cancelAllJobs()
Definition: jobs.cpp:58
EditorTab::dbusId
int dbusId()
Definition: editortab.h:116
DocPosition::Part
Part
Definition: pos.h:40
WidgetTextCaptureConfig
Definition: widgettextcaptureconfig.h:31
EditorState::dockWidgets
QByteArray dockWidgets
Definition: editortab.h:67
tmtab.h
ProjectScriptingPlugin
Definition: lokalizemainwindow.h:173
Project::instance
static Project * instance()
Definition: project.cpp:67
ProjectTab::setLegacyUnitsCount
void setLegacyUnitsCount(int to)
Definition: projecttab.cpp:353
LokalizeMainWindow::showProjectOverview
Q_SCRIPTABLE void showProjectOverview()
Definition: lokalizemainwindow.cpp:386
LokalizeMainWindow::editorIndexForFile
Q_SCRIPTABLE int editorIndexForFile(const QString &path)
part of editor DBus path: /ThisIsWhatYouWant/Editor/
Definition: lokalizemainwindow.cpp:970
EditorTab::findEntryBySourceContext
Q_SCRIPTABLE bool findEntryBySourceContext(const QString &source, const QString &ctxt)
Definition: editortab_findreplace.cpp:672
LokalizeMainWindow::pid
Q_SCRIPTABLE int pid()
Definition: lokalizemainwindow.cpp:981
MultiEditorAdaptor::setEditorTab
void setEditorTab(EditorTab *e)
Definition: lokalizemainwindow.cpp:994
Project::local
static ProjectLocal * local()
Definition: project.h:116
LokalizeSubwindowBase::showDocks
virtual void showDocks()=0
ID_STATUS_CURRENT
#define ID_STATUS_CURRENT
Definition: actionproxy.h:93
editortab.h
prefs.h
LokalizeMainWindow::openFileInEditor
Q_SCRIPTABLE int openFileInEditor(const QString &path)
Adds new editor with.
Definition: lokalizemainwindow.cpp:948
LokalizeMainWindow::readProperties
void readProperties(const KConfigGroup &stateGroup)
Definition: lokalizemainwindow.cpp:660
QObject
ProjectTab::unitsCount
int unitsCount()
Definition: projecttab.h:60
multieditoradaptor.h
projecttab.h
EditorState::entry
int entry
Definition: editortab.h:70
DocPosition
This struct represents a position in a catalog.
Definition: pos.h:38
LokalizeMainWindow::lookupInTranslationMemory
int lookupInTranslationMemory(DocPosition::Part part, const QString &text)
Definition: lokalizemainwindow.cpp:917
ProjectScriptingPlugin::ProjectScriptingPlugin
ProjectScriptingPlugin(QObject *lokalize, QObject *editor)
Definition: lokalizemainwindow.cpp:789
widgettextcaptureconfig.h
TM::TMTab::dbusId
int dbusId()
Definition: tmtab.h:70
MultiEditorAdaptor
Hack over QDBusAbstractAdaptor to get kross active-editor-adaptor for free.
Definition: multieditoradaptor.h:37
PROJECTRCFILE
#define PROJECTRCFILE
Definition: lokalizemainwindow.cpp:785
Project
Singleton object that represents project.
Definition: project.h:51
FileSearchTab
Global file search/repalce tab.
Definition: filesearchtab.h:58
ID_STATUS_TOTAL
#define ID_STATUS_TOTAL
Definition: actionproxy.h:94
LokalizeMainWindow::dbusName
Q_SCRIPTABLE QString dbusName()
Definition: lokalizemainwindow.cpp:982
KXmlGuiWindow
LokalizeMainWindow::fileSearchNext
void fileSearchNext()
Definition: lokalizemainwindow.cpp:429
LokalizeSubwindowBase::guiClient
virtual KXMLGUIClient * guiClient()=0
EditorTab::currentUrl
KUrl currentUrl()
Definition: editortab.cpp:1401
EditorState::mergeUrl
KUrl mergeUrl
Definition: editortab.h:69
LokalizeMainWindow::registerDBusAdaptor
void registerDBusAdaptor()
Definition: lokalizemainwindow.cpp:871
FileSearchTab::fileSearchNext
void fileSearchNext()
Definition: filesearchtab.cpp:695
ID_STATUS_FUZZY
#define ID_STATUS_FUZZY
Definition: actionproxy.h:95
Project::model
ProjectModel * model()
Definition: project.cpp:264
LokalizeMainWindow::busyCursor
Q_SCRIPTABLE void busyCursor(bool busy)
Definition: lokalizemainwindow.cpp:983
projectlocal.h
Project::queryCloseForAuxiliaryWindows
bool queryCloseForAuxiliaryWindows()
Definition: project.cpp:225
LokalizeMainWindow::showTM
TM::TMTab * showTM()
Definition: lokalizemainwindow.cpp:392
FileSearchTab::addFilesToSearch
Q_SCRIPTABLE void addFilesToSearch(const QStringList &)
Definition: filesearchtab.cpp:763
lokalizemainwindow.h
LokalizeMainWindow::editorActivated
Q_SCRIPTABLE void editorActivated()
LokalizeSubwindowBase::hideDocks
virtual void hideDocks()=0
LokalizeMainWindow::~LokalizeMainWindow
~LokalizeMainWindow()
Definition: lokalizemainwindow.cpp:148
LokalizeMainWindow::saveProjectState
void saveProjectState(KConfigGroup &)
Definition: lokalizemainwindow.cpp:600
LokalizeMainWindow::openFileInEditorAt
Q_SCRIPTABLE int openFileInEditorAt(const QString &path, const QString &source, const QString &ctxt)
Definition: lokalizemainwindow.cpp:941
MultiEditorAdaptor::MultiEditorAdaptor
MultiEditorAdaptor(EditorTab *parent)
Definition: lokalizemainwindow.cpp:987
LokalizeSubwindowBase
Interface for LokalizeMainWindow.
Definition: lokalizesubwindowbase.h:39
LokalizeMainWindow::editorForFile
Q_SCRIPTABLE QObject * editorForFile(const QString &path)
Definition: lokalizemainwindow.cpp:962
EditorState::url
KUrl url
Definition: editortab.h:68
ProjectTab
Project Overview Tab.
Definition: projecttab.h:43
EditorTab::setFullPathShown
void setFullPathShown(bool)
Definition: editortab.cpp:757
SettingsController::instance
static SettingsController * instance()
Definition: prefs.cpp:70
Project::load
void load(const QString &file)
Definition: project.cpp:115
LokalizeMainWindow::widgetTextCapture
void widgetTextCapture()
Definition: lokalizemainwindow.cpp:755
SettingsController::projectOpen
QString projectOpen(QString path=QString(), bool doOpen=true)
Definition: prefs.cpp:196
Project::poDir
QString poDir() const
Definition: project.h:68
PROJECTRCFILEDIR
#define PROJECTRCFILEDIR
Definition: lokalizemainwindow.cpp:786
LokalizeMainWindow
Lokalize MDI (tabbed) window.
Definition: lokalizemainwindow.h:60
ID_STATUS_ISFUZZY
#define ID_STATUS_ISFUZZY
Definition: actionproxy.h:97
jobs.h
LokalizeMainWindow::LokalizeMainWindow
LokalizeMainWindow()
Definition: lokalizemainwindow.cpp:81
projectmodel.h
LokalizeMainWindow::activeEditor
Q_SCRIPTABLE QObject * activeEditor()
Definition: lokalizemainwindow.cpp:953
LokalizeMainWindow::closeProject
Q_SCRIPTABLE bool closeProject()
Definition: lokalizemainwindow.cpp:560
LokalizeSubwindowBase::statusBarItems
StatusBarProxy statusBarItems
Definition: lokalizesubwindowbase.h:63
prefs_lokalize.h
EditorTab::gotoEntry
void gotoEntry(DocPosition pos, int selection=0)
Definition: editortab.cpp:986
TM::TMTab::lookup
Q_SCRIPTABLE void lookup(QString source, QString target)
Definition: tmtab.cpp:733
EditorTab::state
EditorState state()
Definition: editortab.cpp:929
EditorState
Definition: editortab.h:60
SettingsController
Singleton that manages cfgs for Lokalize and projects.
Definition: prefs.h:36
ProjectScriptingPlugin::~ProjectScriptingPlugin
~ProjectScriptingPlugin()
Definition: lokalizemainwindow.cpp:841
LokalizeMainWindow::showFileSearch
FileSearchTab * showFileSearch(bool activate=true)
Definition: lokalizemainwindow.cpp:413
DocPosition::Source
Definition: pos.h:43
Project::path
QString path() const
Definition: project.h:66
StatusBarProxy::unregisterStatusBar
void unregisterStatusBar()
Definition: actionproxy.h:84
LokalizeMainWindow::addFilesToSearch
void addFilesToSearch(const QStringList &)
Definition: lokalizemainwindow.cpp:436
ProjectLocal::firstRun
bool firstRun() const
Get FirstRun.
Definition: projectlocal.h:47
LokalizeMainWindow::projectOverview
Q_SCRIPTABLE QObject * projectOverview()
Definition: lokalizemainwindow.cpp:369
LokalizeMainWindow::queryClose
bool queryClose()
Definition: lokalizemainwindow.cpp:241
EditorTab
Editor tab.
Definition: editortab.h:85
DelayedFileOpener::DelayedFileOpener
DelayedFileOpener(const KUrl::List &urls, LokalizeMainWindow *lmw)
Definition: lokalizemainwindow.cpp:1016
LokalizeMainWindow::editorAdded
Q_SCRIPTABLE void editorAdded()
LokalizeMainWindow::setupActions
void setupActions()
Definition: lokalizemainwindow.cpp:449
ADD_ACTION_SHORTCUT
#define ADD_ACTION_SHORTCUT(_name, _text, _shortcut)
LokalizeMainWindow::saveProperties
void saveProperties(KConfigGroup &stateGroup)
Definition: lokalizemainwindow.cpp:595
LokalizeMainWindow::currentProject
Q_SCRIPTABLE QString currentProject()
Definition: lokalizemainwindow.cpp:978
LokalizeMainWindow::fileOpen
EditorTab * fileOpen(KUrl url=KUrl(), int entry=0, bool setAsActive=true, const QString &mergeFile=QString(), bool silent=false)
Definition: lokalizemainwindow.cpp:264
LokalizeSubwindowBase2
C++ casting workaround.
Definition: lokalizesubwindowbase.h:70
TM::TMTab
Translation Memory tab.
Definition: tmtab.h:56
DocPosition::UndefPart
Definition: pos.h:42
LokalizeMainWindow::showTranslationMemory
Q_SCRIPTABLE int showTranslationMemory()
Definition: lokalizemainwindow.cpp:933
ProjectScriptingPlugin::setDOMDocument
void setDOMDocument(const QDomDocument &document, bool merge=false)
Definition: lokalizemainwindow.cpp:816
actionproxy.h
EditorTab::fileOpen
bool fileOpen(KUrl url=KUrl(), KUrl baseUrl=KUrl(), bool silent=false)
Definition: editortab.cpp:789
EditorAdaptor
ID_STATUS_UNTRANS
#define ID_STATUS_UNTRANS
Definition: actionproxy.h:96
EditorTab::setProperFocus
void setProperFocus()
Definition: editortab.cpp:732
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:03:45 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

lokalize

Skip menu "lokalize"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal