• 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
  • catalog
catalog.cpp
Go to the documentation of this file.
1 /* ****************************************************************************
2  This file is part of Lokalize
3  This file contains parts of KBabel code
4 
5  Copyright (C) 1999-2000 by Matthias Kiefer <matthias.kiefer@gmx.de>
6  2001-2005 by Stanislav Visnovsky <visnovsky@kde.org>
7  2006 by Nicolas Goutte <goutte@kde.org>
8  2007-2012 by Nick Shaforostoff <shafff@ukr.net>
9 
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 
24  In addition, as a special exception, the copyright holders give
25  permission to link the code of this program with any edition of
26  the Qt library by Trolltech AS, Norway (or with modified versions
27  of Qt that use the same license as Qt), and distribute linked
28  combinations including the two. You must obey the GNU General
29  Public License in all respects for all of the code used other than
30  Qt. If you modify this file, you may extend this exception to
31  your version of the file, but you are not obligated to do so. If
32  you do not wish to do so, delete this exception statement from
33  your version.
34 
35 **************************************************************************** */
36 // #define KDE_NO_DEBUG_OUTPUT
37 
38 #include "catalog.h"
39 #include "catalog_private.h"
40 #include "project.h"
41 #include "projectmodel.h" //to notify about modification
42 
43 #include "catalogstorage.h"
44 #include "gettextstorage.h"
45 #include "gettextimport.h"
46 #include "gettextexport.h"
47 #include "xliffstorage.h"
48 #include "tsstorage.h"
49 
50 #include "mergecatalog.h"
51 
52 #include "version.h"
53 #include "prefs_lokalize.h"
54 #include "jobs.h"
55 
56 #include <threadweaver/ThreadWeaver.h>
57 
58 #include <QProcess>
59 #include <QString>
60 #include <QMap>
61 
62 #include <kdebug.h>
63 #include <kglobal.h>
64 #include <klocale.h>
65 #include <kdatetime.h>
66 
67 #include <kio/netaccess.h>
68 #include <ktemporaryfile.h>
69 
70 QString Catalog::supportedMimeFilters("text/x-gettext-translation application/x-xliff application/x-linguist");
71 
72 static const char* const extensions[]={".po",".pot",".xlf", ".ts"};
73 
74 static const char* const xliff_states[]={
75  I18N_NOOP("New"),I18N_NOOP("Needs translation"),I18N_NOOP("Needs full localization"),I18N_NOOP("Needs adaptation"),I18N_NOOP("Translated"),
76  I18N_NOOP("Needs translation review"),I18N_NOOP("Needs full localization review"),I18N_NOOP("Needs adaptation review"),I18N_NOOP("Final"),
77  I18N_NOOP("Signed-off")};
78 
79 const char* const* Catalog::states()
80 {
81  return xliff_states;
82 }
83 
84 QStringList Catalog::supportedExtensions()
85 {
86  QStringList result;
87  int i=sizeof(extensions)/sizeof(char*);
88  while (--i>=0)
89  result.append(QString(extensions[i]));
90  return result;
91 }
92 
93 bool Catalog::extIsSupported(const QString& path)
94 {
95  QStringList ext=supportedExtensions();
96  int i=ext.size();
97  while (--i>=0 && !path.endsWith(ext.at(i)))
98  ;
99  return i!=-1;
100 }
101 
102 Catalog::Catalog(QObject *parent)
103  : QUndoStack(parent)
104  , d(new CatalogPrivate(this))
105  , m_storage(0)
106 {
107  //cause refresh events for files modified from lokalize itself aint delivered automatically
108  connect(this,SIGNAL(signalFileSaved(KUrl)),
109  Project::instance()->model(),SLOT(slotFileSaved(KUrl)),Qt::QueuedConnection);
110 
111 
112  QTimer* t=&(d->_autoSaveTimer);
113  t->setInterval(5*60*1000);
114  t->setSingleShot(false);
115  connect(t, SIGNAL(timeout()), this,SLOT(doAutoSave()));
116  connect(this,SIGNAL(signalFileSaved()), t,SLOT(start()));
117  connect(this,SIGNAL(signalFileLoaded()), t,SLOT(start()));
118  connect(this,SIGNAL(indexChanged(int)),this,SLOT(setAutoSaveDirty()));
119  connect(Project::local(),SIGNAL(configChanged()),this,SLOT(projectConfigChanged()));
120 }
121 
122 Catalog::~Catalog()
123 {
124  clear();
125  delete d;
126  //delete m_storage; //deleted in clear();
127 }
128 
129 
130 void Catalog::clear()
131 {
132  setIndex(cleanIndex());//to keep TM in sync
133  QUndoStack::clear();
134  d->_errorIndex.clear();
135  d->_nonApprovedIndex.clear();
136  d->_emptyIndex.clear();
137  delete m_storage;m_storage=0;
138  d->_url.clear();
139  d->_lastModifiedPos=DocPosition();
140  d->_modifiedEntries.clear();
141 
142  while (!d->_altTransCatalogs.isEmpty())
143  d->_altTransCatalogs.takeFirst()->deleteLater();
144 
145  d->_altTranslations.clear();
146 /*
147  d->msgidDiffList.clear();
148  d->msgstr2MsgidDiffList.clear();
149  d->diffCache.clear();
150  */
151 }
152 
153 
154 
155 void Catalog::push(QUndoCommand* cmd)
156 {
157  generatePhaseForCatalogIfNeeded(this);
158  QUndoStack::push(cmd);
159 }
160 
161 
162 //BEGIN STORAGE TRANSLATION
163 
164 int Catalog::capabilities() const
165 {
166  if (KDE_ISUNLIKELY( !m_storage )) return 0;
167 
168  return m_storage->capabilities();
169 }
170 
171 int Catalog::numberOfEntries() const
172 {
173  if (KDE_ISUNLIKELY( !m_storage )) return 0;
174 
175  return m_storage->size();
176 }
177 
178 
179 static DocPosition alterForSinglePlural(const Catalog* th, DocPosition pos)
180 {
181  //if source lang is english (implied) and target lang has only 1 plural form (e.g. Chinese)
182  if (KDE_ISUNLIKELY(th->numberOfPluralForms()==1 && th->isPlural(pos)))
183  pos.form=1;
184  return pos;
185 }
186 
187 QString Catalog::msgid(const DocPosition& pos) const
188 {
189  if (KDE_ISUNLIKELY( !m_storage ))
190  return d->CatalogPrivate::_emptyStr;
191 
192  return m_storage->source(alterForSinglePlural(this, pos));
193 }
194 
195 QString Catalog::msgstr(const DocPosition& pos) const
196 {
197  if (KDE_ISUNLIKELY( !m_storage ))
198  return d->CatalogPrivate::_emptyStr;
199 
200  return m_storage->target(pos);
201 }
202 
203 CatalogString Catalog::sourceWithTags(const DocPosition& pos) const
204 {
205  if (KDE_ISUNLIKELY( !m_storage ))
206  return CatalogString();
207 
208  return m_storage->sourceWithTags(alterForSinglePlural(this, pos));
209 
210 }
211 CatalogString Catalog::targetWithTags(const DocPosition& pos) const
212 {
213  if (KDE_ISUNLIKELY( !m_storage ))
214  return CatalogString();
215 
216  return m_storage->targetWithTags(pos);
217 }
218 
219 CatalogString Catalog::catalogString(const DocPosition& pos) const
220 {
221  if (KDE_ISUNLIKELY( !m_storage ))
222  return CatalogString();
223 
224  return m_storage->catalogString(pos.part==DocPosition::Source?alterForSinglePlural(this, pos):pos);
225 }
226 
227 
228 QVector<Note> Catalog::notes(const DocPosition& pos) const
229 {
230  if (KDE_ISUNLIKELY( !m_storage ))
231  return QVector<Note>();
232 
233  return m_storage->notes(pos);
234 }
235 
236 QVector<Note> Catalog::developerNotes(const DocPosition& pos) const
237 {
238  if (KDE_ISUNLIKELY( !m_storage ))
239  return QVector<Note>();
240 
241  return m_storage->developerNotes(pos);
242 }
243 
244 Note Catalog::setNote(const DocPosition& pos, const Note& note)
245 {
246  if (KDE_ISUNLIKELY( !m_storage ))
247  return Note();
248 
249  return m_storage->setNote(pos,note);
250 }
251 
252 QStringList Catalog::noteAuthors() const
253 {
254  if (KDE_ISUNLIKELY( !m_storage ))
255  return QStringList();
256 
257  return m_storage->noteAuthors();
258 }
259 
260 void Catalog::attachAltTransCatalog(Catalog* altCat)
261 {
262  d->_altTransCatalogs.append(altCat);
263  if (numberOfEntries()!=altCat->numberOfEntries())
264  kWarning()<<altCat->url().prettyUrl()<<"has different number of entries";
265 }
266 
267 void Catalog::attachAltTrans(int entry, const AltTrans& trans)
268 {
269  d->_altTranslations.insert(entry, trans);
270 }
271 
272 QVector<AltTrans> Catalog::altTrans(const DocPosition& pos) const
273 {
274  QVector<AltTrans> result;
275  if (m_storage)
276  result=m_storage->altTrans(pos);
277 
278  foreach(Catalog* altCat, d->_altTransCatalogs)
279  {
280  if (pos.entry>=altCat->numberOfEntries())
281  {
282  kDebug()<<"ignoring"<<altCat->url().prettyUrl()<<"this time because"<<pos.entry<<"<"<<altCat->numberOfEntries();
283  continue;
284  }
285 
286  if (altCat->source(pos)!=source(pos))
287  {
288  kDebug()<<"ignoring"<<altCat->url().prettyUrl()<<"this time because <source>s don't match";
289  continue;
290  }
291 
292  QString target=altCat->msgstr(pos);
293  if (!target.isEmpty() && altCat->isApproved(pos))
294  {
295  result<<AltTrans();
296  result.last().target=target;
297  result.last().type=AltTrans::Reference;
298  result.last().origin=altCat->url().prettyUrl();
299  }
300  }
301  if (d->_altTranslations.contains(pos.entry))
302  result<<d->_altTranslations.value(pos.entry);
303  return result;
304 }
305 
306 QStringList Catalog::sourceFiles(const DocPosition& pos) const
307 {
308  if (KDE_ISUNLIKELY( !m_storage ))
309  return QStringList();
310 
311  return m_storage->sourceFiles(pos);
312 }
313 
314 QString Catalog::id(const DocPosition& pos) const
315 {
316  if (KDE_ISUNLIKELY( !m_storage ))
317  return d->CatalogPrivate::_emptyStr;
318 
319  return m_storage->id(pos);
320 }
321 
322 QStringList Catalog::context(const DocPosition& pos) const
323 {
324  if (KDE_ISUNLIKELY( !m_storage ))
325  return QStringList();
326 
327  return m_storage->context(pos);
328 }
329 
330 QString Catalog::setPhase(const DocPosition& pos, const QString& phase)
331 {
332  if (KDE_ISUNLIKELY( !m_storage ))
333  return QString();
334 
335  return m_storage->setPhase(pos,phase);
336 }
337 
338 
339 void Catalog::setActivePhase(const QString& phase, ProjectLocal::PersonRole role)
340 {
341  d->_phase=phase;
342  d->_phaseRole=role;
343  updateApprovedEmptyIndexCache();
344  emit activePhaseChanged();
345 }
346 
347 void Catalog::updateApprovedEmptyIndexCache()
348 {
349  if (KDE_ISUNLIKELY( !m_storage ))
350  return;
351 
352  //index cache TODO profile?
353  d->_nonApprovedIndex.clear();
354  d->_emptyIndex.clear();
355 
356  DocPosition pos(0);
357  const int limit=m_storage->size();
358  while (pos.entry<limit)
359  {
360  if (!isApproved(pos))
361  d->_nonApprovedIndex << pos.entry;
362  if (m_storage->isEmpty(pos))
363  d->_emptyIndex << pos.entry;
364 
365  ++(pos.entry);
366  }
367 
368  emit signalNumberOfFuzziesChanged();
369  emit signalNumberOfEmptyChanged();
370 }
371 
372 QString Catalog::phase(const DocPosition& pos) const
373 {
374  if (KDE_ISUNLIKELY( !m_storage ))
375  return QString();
376 
377  return m_storage->phase(pos);
378 }
379 
380 Phase Catalog::phase(const QString& name) const
381 {
382  return m_storage->phase(name);
383 }
384 
385 QList<Phase> Catalog::allPhases() const
386 {
387  return m_storage->allPhases();
388 }
389 
390 QVector<Note> Catalog::phaseNotes(const QString& phase) const
391 {
392  return m_storage->phaseNotes(phase);
393 }
394 
395 QVector<Note> Catalog::setPhaseNotes(const QString& phase, QVector<Note> notes)
396 {
397  return m_storage->setPhaseNotes(phase, notes);
398 }
399 
400 QMap<QString,Tool> Catalog::allTools() const
401 {
402  return m_storage->allTools();
403 }
404 
405 bool Catalog::isPlural(uint index) const
406 {
407  return m_storage && m_storage->isPlural(DocPosition(index));
408 }
409 
410 bool Catalog::isApproved(uint index) const
411 {
412  if (KDE_ISUNLIKELY( !m_storage ))
413  return false;
414 
415  bool extendedStates=m_storage->capabilities()&ExtendedStates;
416 
417  return (extendedStates&&::isApproved(state(DocPosition(index)),activePhaseRole()))
418  ||(!extendedStates&&m_storage->isApproved(DocPosition(index)));
419 }
420 
421 TargetState Catalog::state(const DocPosition& pos) const
422 {
423  if (KDE_ISUNLIKELY( !m_storage ))
424  return NeedsTranslation;
425 
426  if (m_storage->capabilities()&ExtendedStates)
427  return m_storage->state(pos);
428  else
429  return closestState(m_storage->isApproved(pos), activePhaseRole());
430 }
431 
432 bool Catalog::isEmpty(uint index) const
433 {
434  return m_storage && m_storage->isEmpty(DocPosition(index));
435 }
436 
437 bool Catalog::isEmpty(const DocPosition& pos) const
438 {
439  return m_storage && m_storage->isEmpty(pos);
440 }
441 
442 
443 bool Catalog::isEquivTrans(const DocPosition& pos) const
444 {
445  return m_storage && m_storage->isEquivTrans(pos);
446 }
447 
448 int Catalog::binUnitsCount() const
449 {
450  return m_storage?m_storage->binUnitsCount():0;
451 }
452 
453 int Catalog::unitById(const QString& id) const
454 {
455  return m_storage?m_storage->unitById(id):0;
456 }
457 
458 QString Catalog::mimetype()
459 {
460  if (KDE_ISUNLIKELY( !m_storage ))
461  return QString();
462 
463  return m_storage->mimetype();
464 }
465 
466 QString Catalog::sourceLangCode() const
467 {
468  if (KDE_ISUNLIKELY( !m_storage ))
469  return QString();
470 
471  return m_storage->sourceLangCode();
472 }
473 
474 QString Catalog::targetLangCode() const
475 {
476  if (KDE_ISUNLIKELY( !m_storage ))
477  return QString();
478 
479  return m_storage->targetLangCode();
480 }
481 
482 //END STORAGE TRANSLATION
483 
484 //BEGIN OPEN/SAVE
485 #define DOESNTEXIST -1
486 #define ISNTREADABLE -2
487 #define UNKNOWNFORMAT -3
488 
489 KAutoSaveFile* Catalog::checkAutoSave(const KUrl& url)
490 {
491  KAutoSaveFile* autoSave=0;
492  QList<KAutoSaveFile*> staleFiles = KAutoSaveFile::staleFiles(url);
493  foreach (KAutoSaveFile *stale, staleFiles)
494  {
495  if (stale->open(QIODevice::ReadOnly) && !autoSave)
496  {
497  autoSave=stale;
498  autoSave->setParent(this);
499  }
500  else
501  stale->deleteLater();
502  }
503  if (autoSave)
504  kWarning()<<"autoSave"<<autoSave->fileName();
505  return autoSave;
506 }
507 
508 int Catalog::loadFromUrl(const KUrl& url, const KUrl& saidUrl, int* fileSize)
509 {
510  bool readOnly=false;
511  if (url.isLocalFile())
512  {
513  QFileInfo info(url.toLocalFile());
514  if(KDE_ISUNLIKELY( !info.exists() || info.isDir()) )
515  return DOESNTEXIST;
516  if(KDE_ISUNLIKELY( !info.isReadable() ))
517  return ISNTREADABLE;
518  readOnly=!info.isWritable();
519  }
520  else
521  return DOESNTEXIST;
522 
523 
524  QTime a;a.start();
525 
526  QString target;
527  //if(KDE_ISUNLIKELY( !KIO::NetAccess::download(url,target,NULL) ))
528  // return ISNTREADABLE;
529  //QFile* file=new QFile(target);
530  QFile* file=new QFile(url.toLocalFile());
531  file->deleteLater();//kung-fu
532  if (!file->open(QIODevice::ReadOnly))
533  return ISNTREADABLE;//TODO
534 
535  CatalogStorage* storage=0;
536  const QString& fileName=url.fileName();
537  if (fileName.endsWith(".po")||fileName.endsWith(".pot"))
538  storage=new GettextCatalog::GettextStorage;
539  else if (fileName.endsWith(".xlf")||fileName.endsWith(".xliff"))
540  storage=new XliffStorage;
541  else if (fileName.endsWith(".ts"))
542  storage=new TsStorage;
543  else
544  {
545  //try harder
546  QTextStream in(file);
547  int i=0;
548  bool gettext=false;
549  while (!in.atEnd()&& i<64 && !gettext)
550  gettext=in.readLine().contains("msgid");
551  if (gettext) storage=new GettextCatalog::GettextStorage;
552  else return UNKNOWNFORMAT;
553  }
554 
555  int line=storage->load(file);
556 
557  file->close();
558  KIO::NetAccess::removeTempFile(target);
559 
560  if (KDE_ISUNLIKELY(line!=0 || (!storage->size() && (line=-1) ) ))
561  {
562  delete storage;
563  return line;
564  }
565 
566  kWarning() <<"file opened in"<<a.elapsed();
567 
568  //ok...
569  clear();
570 
571  //commit transaction
572  m_storage=storage;
573 
574  updateApprovedEmptyIndexCache();
575 
576  d->_numberOfPluralForms = storage->numberOfPluralForms();
577  d->_autoSaveDirty=true;
578  d->_readOnly=readOnly;
579  d->_url=saidUrl.isEmpty()?url:saidUrl;
580 
581  KAutoSaveFile* autoSave=checkAutoSave(d->_url);
582  d->_autoSaveRecovered=autoSave;
583  if (autoSave)
584  {
585  d->_autoSave->deleteLater();
586  d->_autoSave=autoSave;
587 
588  //restore 'modified' status for entries
589  MergeCatalog* mergeCatalog=new MergeCatalog(this,this);
590  int errorLine=mergeCatalog->loadFromUrl(KUrl::fromPath(autoSave->fileName()));
591  if (KDE_ISLIKELY(errorLine==0))
592  mergeCatalog->copyToBaseCatalog();
593  mergeCatalog->deleteLater();
594  }
595  else
596  d->_autoSave->setManagedFile(d->_url);
597 
598  if (fileSize)
599  *fileSize=file->size();
600 
601  emit signalFileLoaded();
602  emit signalFileLoaded(d->_url);
603  return 0;
604 }
605 
606 bool Catalog::save()
607 {
608  return saveToUrl(d->_url);
609 }
610 
611 //this function is not called if QUndoStack::isClean() !
612 bool Catalog::saveToUrl(KUrl url)
613 {
614  if (KDE_ISUNLIKELY( !m_storage ))
615  return true;
616 
617  bool nameChanged=false;
618  if (KDE_ISLIKELY( url.isEmpty() ))
619  url = d->_url;
620  else
621  nameChanged=true;
622 
623 
624  bool remote=!url.isLocalFile();
625  QFile* file;
626  if (KDE_ISUNLIKELY( remote ))
627  file=new KTemporaryFile();
628  else
629  {
630  QString localFilePath=url.toLocalFile();
631  QString localPath=QFileInfo(localFilePath).absolutePath();
632  if (!QFileInfo(localPath).exists())
633  if (!QDir::root().mkpath(localPath))
634  return false;
635  file=new QFile(localFilePath);
636  }
637  file->deleteLater(); //kung-fu ;)
638  if (KDE_ISUNLIKELY( !file->open(QIODevice::WriteOnly) )) //i18n("Wasn't able to open file %1",filename.ascii());
639  return false;
640 
641  bool belongsToProject=url.path().contains(Project::instance()->poDir());
642  if (KDE_ISUNLIKELY( !m_storage->save(file, belongsToProject) ))
643  return false;
644 
645  QString localFile=file->fileName();
646  file->close();
647  if (KDE_ISUNLIKELY(remote && !KIO::NetAccess::upload(localFile, url, NULL) ))
648  return false;
649 
650  d->_autoSave->remove();
651  setClean(); //undo/redo
652  if (nameChanged)
653  {
654  d->_url=url;
655  d->_autoSave->setManagedFile(url);
656  }
657  d->_autoSaveRecovered=false;
658 
659  //Settings::self()->setCurrentGroup("Bookmarks");
660  //Settings::self()->addItemIntList(d->_url.url(),d->_bookmarkIndex);
661 
662  emit signalFileSaved();
663  emit signalFileSaved(url);
664  return true;
665 /*
666  else if (status==NO_PERMISSIONS)
667  {
668  if (KMessageBox::warningContinueCancel(this,
669  i18n("You do not have permission to write to file:\n%1\n"
670  "Do you want to save to another file or cancel?", _currentURL.prettyUrl()),
671  i18n("Error"),KStandardGuiItem::save())==KMessageBox::Continue)
672  return fileSaveAs();
673 
674  }
675 */
676 }
677 
678 void Catalog::doAutoSave()
679 {
680  if (isClean()||!(d->_autoSaveDirty))
681  return;
682  if (KDE_ISUNLIKELY( !m_storage ))
683  return;
684  if (!d->_autoSave->open(QIODevice::WriteOnly))
685  {
686  emit signalFileAutoSaveFailed(d->_autoSave->fileName());
687  return;
688  }
689  qWarning()<<"doAutoSave"<<d->_autoSave->fileName();
690  m_storage->save(d->_autoSave);
691  d->_autoSave->close();
692  d->_autoSaveDirty=false;
693 }
694 
695 void Catalog::projectConfigChanged()
696 {
697  setActivePhase(activePhase(), Project::local()->role());
698 }
699 
700 QByteArray Catalog::contents()
701 {
702  QBuffer buf;
703  buf.open(QIODevice::WriteOnly);
704  m_storage->save(&buf);
705  buf.close();
706  return buf.data();
707 }
708 
709 //END OPEN/SAVE
710 
711 
712 
719 static void updateDB(
720  const QString& filePath,
721  const QString& ctxt,
722  const CatalogString& english,
723  const CatalogString& newTarget,
724  int form,
725  bool approved
726  //const DocPosition&,//for back tracking
727  )
728 {
729  TM::UpdateJob* j=new TM::UpdateJob(filePath,ctxt,english,newTarget,form,approved,
730  Project::instance()->projectID());
731  j->connect(j,SIGNAL(done(ThreadWeaver::Job*)),j,SLOT(deleteLater()));
732  ThreadWeaver::Weaver::instance()->enqueue(j);
733 }
734 
735 
736 //BEGIN UNDO/REDO
737 const DocPosition& Catalog::undo()
738 {
739  QUndoStack::undo();
740  return d->_lastModifiedPos;
741 }
742 
743 const DocPosition& Catalog::redo()
744 {
745  QUndoStack::redo();
746  return d->_lastModifiedPos;
747 }
748 
749 void Catalog::flushUpdateDBBuffer()
750 {
751  if (!Settings::autoaddTM())
752  return;
753 
754  DocPosition pos=d->_lastModifiedPos;
755  if (pos.entry==-1 || pos.entry>=numberOfEntries())
756  {
757  //nothing to flush
758  //kWarning()<<"nothing to flush or new file opened";
759  return;
760  }
761  if (Project::instance()->targetLangCode()!=targetLangCode())
762  {
763  kWarning()<<"not updating because target languages don't match";
764  return;
765  }
766  kWarning()<<"updating!!";
767  int form=-1;
768  if (isPlural(pos.entry))
769  form=pos.form;
770  updateDB(url().pathOrUrl(),
771  context(pos.entry).first(),
772  sourceWithTags(pos),
773  targetWithTags(pos),
774  form,
775  isApproved(pos.entry));
776 
777  d->_lastModifiedPos=DocPosition();
778 }
779 
780 void Catalog::setLastModifiedPos(const DocPosition& pos)
781 {
782  if (pos.entry>=numberOfEntries()) //bin-units
783  return;
784 
785  bool entryChanged=DocPos(d->_lastModifiedPos)!=DocPos(pos);
786  if (entryChanged)
787  flushUpdateDBBuffer();
788 
789  d->_lastModifiedPos=pos;
790 }
791 
792 bool CatalogPrivate::addToEmptyIndexIfAppropriate(CatalogStorage* storage, const DocPosition& pos, bool alreadyEmpty)
793 {
794  if ((!pos.offset)&&(storage->target(pos).isEmpty())&&(!alreadyEmpty))
795  {
796  insertInList(_emptyIndex,pos.entry);
797  return true;
798  }
799  return false;
800 }
801 
802 void Catalog::targetDelete(const DocPosition& pos, int count)
803 {
804  if (KDE_ISUNLIKELY( !m_storage ))
805  return;
806 
807  bool alreadyEmpty = m_storage->isEmpty(pos);
808  m_storage->targetDelete(pos,count);
809 
810  if (d->addToEmptyIndexIfAppropriate(m_storage,pos,alreadyEmpty))
811  emit signalNumberOfEmptyChanged();
812  emit signalEntryModified(pos);
813 }
814 
815 bool CatalogPrivate::removeFromUntransIndexIfAppropriate(CatalogStorage* storage, const DocPosition& pos)
816 {
817  if ((!pos.offset)&&(storage->isEmpty(pos)))
818  {
819  _emptyIndex.removeAll(pos.entry);
820  return true;
821  }
822  return false;
823 }
824 
825 void Catalog::targetInsert(const DocPosition& pos, const QString& arg)
826 {
827  if (KDE_ISUNLIKELY( !m_storage ))
828  return;
829 
830  if (d->removeFromUntransIndexIfAppropriate(m_storage,pos))
831  emit signalNumberOfEmptyChanged();
832 
833  m_storage->targetInsert(pos,arg);
834  emit signalEntryModified(pos);
835 }
836 
837 void Catalog::targetInsertTag(const DocPosition& pos, const InlineTag& tag)
838 {
839  if (KDE_ISUNLIKELY( !m_storage ))
840  return;
841 
842  if (d->removeFromUntransIndexIfAppropriate(m_storage,pos))
843  emit signalNumberOfEmptyChanged();
844 
845  m_storage->targetInsertTag(pos,tag);
846  emit signalEntryModified(pos);
847 }
848 
849 InlineTag Catalog::targetDeleteTag(const DocPosition& pos)
850 {
851  if (KDE_ISUNLIKELY( !m_storage ))
852  return InlineTag();
853 
854  bool alreadyEmpty = m_storage->isEmpty(pos);
855  InlineTag tag=m_storage->targetDeleteTag(pos);
856 
857  if (d->addToEmptyIndexIfAppropriate(m_storage,pos,alreadyEmpty))
858  emit signalNumberOfEmptyChanged();
859  emit signalEntryModified(pos);
860  return tag;
861 }
862 
863 void Catalog::setTarget(DocPosition pos, const CatalogString& s)
864 {
865  //TODO for case of markup present
866  m_storage->setTarget(pos, s.string);
867 }
868 
869 TargetState Catalog::setState(const DocPosition& pos, TargetState state)
870 {
871  bool extendedStates=m_storage->capabilities()&ExtendedStates;
872  bool approved=::isApproved(state,activePhaseRole());
873  if (KDE_ISUNLIKELY( !m_storage
874  || (extendedStates && m_storage->state(pos)==state)
875  || (!extendedStates && m_storage->isApproved(pos)==approved)))
876  return this->state(pos);
877 
878  TargetState prevState;
879  if (extendedStates)
880  {
881  prevState=m_storage->setState(pos,state);
882  d->_statesIndex[prevState].removeAll(pos.entry);
883  insertInList(d->_statesIndex[state],pos.entry);
884  }
885  else
886  {
887  prevState=closestState(!approved,activePhaseRole());
888  m_storage->setApproved(pos,approved);
889  }
890 
891  if (!approved)
892  insertInList(d->_nonApprovedIndex,pos.entry);
893  else
894  d->_nonApprovedIndex.removeAll(pos.entry);
895 
896  emit signalNumberOfFuzziesChanged();
897  emit signalEntryModified(pos);
898 
899  return prevState;
900 }
901 
902 Phase Catalog::updatePhase(const Phase& phase)
903 {
904  return m_storage->updatePhase(phase);
905 }
906 
907 void Catalog::setEquivTrans(const DocPosition& pos, bool equivTrans)
908 {
909  if (m_storage) m_storage->setEquivTrans(pos, equivTrans);
910 }
911 
912 bool Catalog::setModified(DocPos entry, bool modified)
913 {
914  if (modified)
915  {
916  if (d->_modifiedEntries.contains(entry))
917  return false;
918  d->_modifiedEntries.insert(entry);
919  }
920  else
921  d->_modifiedEntries.remove(entry);
922  return true;
923 }
924 
925 bool Catalog::isModified(DocPos entry) const
926 {
927  return d->_modifiedEntries.contains(entry);
928 }
929 
930 bool Catalog::isModified(int entry) const
931 {
932  if (!isPlural(entry))
933  return isModified(DocPos(entry,0));
934 
935  int f=numberOfPluralForms();
936  while(--f>=0)
937  if (isModified(DocPos(entry,f)))
938  return true;
939  return false;
940 }
941 
942 //END UNDO/REDO
943 
944 
945 
946 
947 int findNextInList(const QLinkedList<int>& list, int index)
948 {
949  int nextIndex=-1;
950  foreach(int key, list)
951  {
952  if (KDE_ISUNLIKELY( key>index ))
953  {
954  nextIndex = key;
955  break;
956  }
957  }
958  return nextIndex;
959 }
960 
961 int findPrevInList(const QLinkedList<int>& list, int index)
962 {
963  int prevIndex=-1;
964  foreach(int key, list)
965  {
966  if (KDE_ISUNLIKELY( key>=index ))
967  break;
968  prevIndex = key;
969  }
970  return prevIndex;
971 }
972 
973 void insertInList(QLinkedList<int>& list, int index)
974 {
975  QLinkedList<int>::Iterator it=list.begin();
976  while(it != list.end() && index > *it)
977  ++it;
978  list.insert(it,index);
979 }
980 
981 void Catalog::setBookmark(uint idx, bool set)
982 {
983  if (set)
984  insertInList(d->_bookmarkIndex,idx);
985  else
986  d->_bookmarkIndex.removeAll(idx);
987 }
988 
989 
990 bool isApproved(TargetState state, ProjectLocal::PersonRole role)
991 {
992  static const TargetState marginStates[]={Translated, Final, SignedOff};
993  return state>=marginStates[role];
994 }
995 
996 bool isApproved(TargetState state)
997 {
998  static const TargetState marginStates[]={Translated, Final, SignedOff};
999  return state==marginStates[0] || state==marginStates[1] || state==marginStates[2];
1000 }
1001 
1002 TargetState closestState(bool approved, ProjectLocal::PersonRole role)
1003 {
1004  static const TargetState approvementStates[][3]={
1005  {NeedsTranslation, NeedsReviewTranslation, NeedsReviewTranslation},
1006  {Translated, Final, SignedOff}
1007  };
1008  return approvementStates[approved][role];
1009 }
1010 
1011 
1012 bool Catalog::isObsolete(int entry) const
1013 {
1014  if (KDE_ISUNLIKELY( !m_storage ))
1015  return false;
1016 
1017  return m_storage->isObsolete(entry);
1018 }
1019 
1020 
1021 #include "catalog.moc"
Catalog::context
QStringList context(const DocPosition &pos) const
Definition: catalog.cpp:322
XliffStorage
Definition: xliffstorage.h:32
xliffstorage.h
DocPosition::part
Part part
Definition: pos.h:49
CatalogPrivate::_phase
QString _phase
Definition: catalog_private.h:107
MergeCatalog
Merge source container.
Definition: mergecatalog.h:71
project.h
ProjectLocal::PersonRole
PersonRole
Definition: projectlocal.h:13
Catalog::url
const KUrl & url() const
Definition: catalog.h:189
Catalog::targetWithTags
CatalogString targetWithTags(const DocPosition &pos) const
Definition: catalog.cpp:211
CatalogStorage::allPhases
virtual QList< Phase > allPhases() const
Definition: catalogstorage.h:79
Catalog::altTrans
QVector< AltTrans > altTrans(const DocPosition &pos) const
Definition: catalog.cpp:272
CatalogStorage::targetInsert
virtual void targetInsert(const DocPosition &pos, const QString &arg)=0
CatalogStorage::source
virtual QString source(const DocPosition &pos) const =0
flat-model interface (ignores XLIFF grouping)
CatalogPrivate::removeFromUntransIndexIfAppropriate
bool removeFromUntransIndexIfAppropriate(CatalogStorage *, const DocPosition &pos)
Definition: catalog.cpp:815
CatalogPrivate::_errorIndex
QLinkedList< int > _errorIndex
Definition: catalog_private.h:91
CatalogStorage::setState
virtual TargetState setState(const DocPosition &, TargetState)
Definition: catalogstorage.h:136
Catalog::contents
QByteArray contents()
Definition: catalog.cpp:700
Catalog::targetLangCode
QString targetLangCode() const
Definition: catalog.cpp:474
Catalog::setEquivTrans
void setEquivTrans(const DocPosition &, bool equivTrans)
Definition: catalog.cpp:907
Catalog::supportedExtensions
static QStringList supportedExtensions()
Definition: catalog.cpp:84
Catalog::numberOfPluralForms
int numberOfPluralForms() const
Definition: catalog.h:150
isApproved
bool isApproved(TargetState state, ProjectLocal::PersonRole role)
Definition: catalog.cpp:990
CatalogPrivate::_modifiedEntries
QSet< DocPos > _modifiedEntries
Definition: catalog_private.h:105
CatalogStorage::catalogString
virtual CatalogString catalogString(const DocPosition &pos) const =0
CatalogPrivate::_bookmarkIndex
QLinkedList< int > _bookmarkIndex
Definition: catalog_private.h:93
Translated
Definition: state.h:36
Catalog::setState
TargetState setState(const DocPosition &pos, TargetState state)
Definition: catalog.cpp:869
CatalogStorage::targetInsertTag
virtual void targetInsertTag(const DocPosition &, const InlineTag &)
Definition: catalogstorage.h:76
CatalogPrivate::_numberOfPluralForms
int _numberOfPluralForms
Definition: catalog_private.h:78
Catalog::m_storage
CatalogStorage * m_storage
Definition: catalog.h:243
CatalogStorage::setApproved
virtual void setApproved(const DocPosition &, bool approved)
Definition: catalogstorage.h:134
Catalog::signalNumberOfFuzziesChanged
void signalNumberOfFuzziesChanged()
Project::instance
static Project * instance()
Definition: project.cpp:67
catalogstorage.h
generatePhaseForCatalogIfNeeded
void generatePhaseForCatalogIfNeeded(Catalog *catalog)
Definition: phase.cpp:47
Catalog::isEmpty
bool isEmpty()
Definition: catalog.h:174
Catalog::phaseNotes
QVector< Note > phaseNotes(const QString &phase) const
Definition: catalog.cpp:390
ISNTREADABLE
#define ISNTREADABLE
Definition: catalog.cpp:486
CatalogStorage::notes
virtual QVector< Note > notes(const DocPosition &pos) const =0
Catalog::activePhaseRole
ProjectLocal::PersonRole activePhaseRole() const
Definition: catalog.h:120
Note
Definition: note.h:29
CatalogPrivate::_url
KUrl _url
url of the po-file, that belongs to this catalog
Definition: catalog_private.h:66
Catalog::MergeCatalog
friend class MergeCatalog
Definition: catalog.h:255
Catalog::redo
virtual const DocPosition & redo()
Definition: catalog.cpp:743
Catalog::signalFileLoaded
Q_SCRIPTABLE void signalFileLoaded()
Catalog::push
void push(QUndoCommand *cmd)
Definition: catalog.cpp:155
CatalogPrivate::_autoSave
KAutoSaveFile * _autoSave
Definition: catalog_private.h:81
CatalogStorage::target
virtual QString target(const DocPosition &pos) const =0
Project::local
static ProjectLocal * local()
Definition: project.h:116
CatalogString::string
QString string
Definition: catalogstring.h:130
Catalog::save
bool save()
Definition: catalog.cpp:606
Catalog::binUnitsCount
int binUnitsCount() const
so DocPosition::entry may actually be < size()+binUnitsCount()
Definition: catalog.cpp:448
tsstorage.h
CatalogStorage::isObsolete
virtual bool isObsolete(int entry) const
Definition: catalogstorage.h:138
Catalog::loadFromUrl
int loadFromUrl(const KUrl &url, const KUrl &saidUrl=KUrl(), int *fileSize=0)
Definition: catalog.cpp:508
Catalog::catalogString
CatalogString catalogString(const DocPosition &pos) const
Definition: catalog.cpp:219
QObject
Catalog::attachAltTrans
void attachAltTrans(int entry, const AltTrans &trans)
Definition: catalog.cpp:267
CatalogStorage::updatePhase
virtual Phase updatePhase(const Phase &)
Definition: catalogstorage.h:78
findPrevInList
int findPrevInList(const QLinkedList< int > &list, int index)
Definition: catalog.cpp:961
CatalogStorage::setTarget
virtual void setTarget(const DocPosition &pos, const QString &arg)=0
CatalogStorage::mimetype
virtual QString mimetype() const =0
Settings::autoaddTM
static bool autoaddTM()
Get AutoaddTM.
Definition: prefs_lokalize.h:331
CatalogPrivate::_phaseRole
ProjectLocal::PersonRole _phaseRole
Definition: catalog_private.h:108
Catalog::setActivePhase
void setActivePhase(const QString &phase, ProjectLocal::PersonRole role=ProjectLocal::Approver)
Definition: catalog.cpp:339
Catalog::allPhases
QList< Phase > allPhases() const
Definition: catalog.cpp:385
CatalogStorage::phase
virtual QString phase(const DocPosition &pos) const
Definition: catalogstorage.h:94
CatalogStorage::sourceFiles
virtual QStringList sourceFiles(const DocPosition &pos) const =0
Catalog::activePhase
QString activePhase() const
Definition: catalog.h:119
NeedsTranslation
Definition: state.h:33
Catalog::isModified
bool isModified(DocPos entry) const
Definition: catalog.cpp:925
CatalogPrivate::_emptyIndex
QLinkedList< int > _emptyIndex
Definition: catalog_private.h:90
DocPosition::offset
uint offset
Definition: pos.h:51
DocPosition::entry
int entry
Definition: pos.h:48
Catalog::developerNotes
QVector< Note > developerNotes(const DocPosition &pos) const
Definition: catalog.cpp:236
Catalog::setModified
bool setModified(DocPos entry, bool modif)
Definition: catalog.cpp:912
Catalog::extIsSupported
static bool extIsSupported(const QString &path)
Definition: catalog.cpp:93
CatalogPrivate::_nonApprovedIndex
QLinkedList< int > _nonApprovedIndex
Definition: catalog_private.h:89
DocPosition
This struct represents a position in a catalog.
Definition: pos.h:38
CatalogStorage::phaseNotes
virtual QVector< Note > phaseNotes(const QString &phase) const
Definition: catalogstorage.h:96
Catalog::setTarget
void setTarget(DocPosition pos, const CatalogString &s)
Definition: catalog.cpp:863
Catalog::targetDeleteTag
InlineTag targetDeleteTag(const DocPosition &pos)
Definition: catalog.cpp:849
Catalog::target
QString target(const DocPosition &pos) const
Definition: catalog.h:96
CatalogStorage::sourceWithTags
virtual CatalogString sourceWithTags(DocPosition pos) const =0
TsStorage
Definition: tsstorage.h:32
CatalogStorage::targetLangCode
QString targetLangCode() const
Definition: catalogstorage.h:149
Catalog::undo
virtual const DocPosition & undo()
Definition: catalog.cpp:737
alterForSinglePlural
static DocPosition alterForSinglePlural(const Catalog *th, DocPosition pos)
Definition: catalog.cpp:179
CatalogStorage::sourceLangCode
QString sourceLangCode() const
Definition: catalogstorage.h:148
Catalog::signalFileSaved
Q_SCRIPTABLE void signalFileSaved()
catalog_private.h
CatalogPrivate::_lastModifiedPos
DocPosition _lastModifiedPos
Definition: catalog_private.h:103
Catalog::targetInsertTag
void targetInsertTag(const DocPosition &pos, const InlineTag &tag)
Definition: catalog.cpp:837
catalog.h
Catalog::isObsolete
bool isObsolete(int entry) const
Definition: catalog.cpp:1012
Catalog::noteAuthors
QStringList noteAuthors() const
Definition: catalog.cpp:252
Catalog::flushUpdateDBBuffer
void flushUpdateDBBuffer()
updates DB for _posBuffer and accompanying _originalForLastModified
Definition: catalog.cpp:749
DocPosition::form
char form
Definition: pos.h:50
CatalogStorage::isEquivTrans
virtual bool isEquivTrans(const DocPosition &) const
Definition: catalogstorage.h:130
Catalog::doAutoSave
void doAutoSave()
Definition: catalog.cpp:678
CatalogStorage::targetWithTags
virtual CatalogString targetWithTags(DocPosition pos) const =0
CatalogStorage::developerNotes
virtual QVector< Note > developerNotes(const DocPosition &pos) const =0
NeedsReviewTranslation
Definition: state.h:37
Catalog::isPlural
bool isPlural(uint index) const
Definition: catalog.cpp:405
QUndoStack
CatalogStorage::binUnitsCount
virtual int binUnitsCount() const
Definition: catalogstorage.h:140
CatalogPrivate::_autoSaveTimer
QTimer _autoSaveTimer
Definition: catalog_private.h:80
Catalog::setPhaseNotes
QVector< Note > setPhaseNotes(const QString &phase, QVector< Note >)
Definition: catalog.cpp:395
Catalog::setAutoSaveDirty
void setAutoSaveDirty()
Definition: catalog.h:209
mergecatalog.h
Catalog::d
CatalogPrivate * d
Definition: catalog.h:242
Catalog::checkAutoSave
virtual KAutoSaveFile * checkAutoSave(const KUrl &url)
Definition: catalog.cpp:489
Phase
Definition: phase.h:34
UNKNOWNFORMAT
#define UNKNOWNFORMAT
Definition: catalog.cpp:487
CatalogStorage
Abstract interface for storage of translation file.
Definition: catalogstorage.h:45
SignedOff
Definition: state.h:41
CatalogStorage::unitById
virtual int unitById(const QString &id) const
Definition: catalogstorage.h:141
Catalog::projectConfigChanged
void projectConfigChanged()
Definition: catalog.cpp:695
CatalogStorage::setPhaseNotes
virtual QVector< Note > setPhaseNotes(const QString &phase, QVector< Note > notes)
Definition: catalogstorage.h:97
CatalogStorage::setEquivTrans
virtual void setEquivTrans(const DocPosition &, bool equivTrans)
Definition: catalogstorage.h:131
AltTrans::Reference
Definition: alttrans.h:33
CatalogStorage::altTrans
virtual QVector< AltTrans > altTrans(const DocPosition &pos) const =0
Catalog::activePhaseChanged
void activePhaseChanged()
Final
Definition: state.h:40
Catalog::capabilities
int capabilities() const
Definition: catalog.cpp:164
xliff_states
static const char *const xliff_states[]
Definition: catalog.cpp:74
Catalog::phase
QString phase(const DocPosition &pos) const
Definition: catalog.cpp:372
Catalog::signalNumberOfEmptyChanged
void signalNumberOfEmptyChanged()
CatalogStorage::save
virtual bool save(QIODevice *device, bool belongsToProject=false)=0
Catalog::~Catalog
virtual ~Catalog()
Definition: catalog.cpp:122
Catalog::targetInsert
void targetInsert(const DocPosition &pos, const QString &arg)
Definition: catalog.cpp:825
Catalog::setNote
Note setNote(const DocPosition &pos, const Note &note)
pos.form is note number
Definition: catalog.cpp:244
version.h
updateDB
static void updateDB(const QString &filePath, const QString &ctxt, const CatalogString &english, const CatalogString &newTarget, int form, bool approved)
helper method to keep db in a good shape :) called on 1) entry switch 2) automatic editing code like ...
Definition: catalog.cpp:719
Catalog::msgid
QString msgid(const DocPosition &) const
Definition: catalog.cpp:187
CatalogString
data structure used to pass info about inline elements a XLIFF tag is represented by a TAGRANGE_IMAGE...
Definition: catalogstring.h:128
jobs.h
Catalog::updatePhase
Phase updatePhase(const Phase &phase)
Definition: catalog.cpp:902
CatalogPrivate::addToEmptyIndexIfAppropriate
bool addToEmptyIndexIfAppropriate(CatalogStorage *, const DocPosition &pos, bool alreadyEmpty)
Definition: catalog.cpp:792
projectmodel.h
insertInList
void insertInList(QLinkedList< int > &list, int index)
Definition: catalog.cpp:973
Catalog::clear
void clear()
Definition: catalog.cpp:130
ExtendedStates
Definition: catalogcapabilities.h:32
prefs_lokalize.h
Catalog::signalEntryModified
void signalEntryModified(const DocPosition &)
Catalog::attachAltTransCatalog
void attachAltTransCatalog(Catalog *)
Definition: catalog.cpp:260
CatalogStorage::isEmpty
virtual bool isEmpty(const DocPosition &) const =0
CatalogPrivate::_altTranslations
QMap< int, AltTrans > _altTranslations
Definition: catalog_private.h:99
CatalogStorage::isPlural
virtual bool isPlural(const DocPosition &) const =0
CatalogStorage::size
virtual int size() const =0
Catalog::sourceWithTags
CatalogString sourceWithTags(const DocPosition &pos) const
Definition: catalog.cpp:203
Catalog::id
QString id(const DocPosition &pos) const
Definition: catalog.cpp:314
DocPosition::Source
Definition: pos.h:43
CatalogStorage::setNote
virtual Note setNote(DocPosition pos, const Note &note)=0
Catalog::isApproved
bool isApproved(uint index) const
Definition: catalog.cpp:410
CatalogStorage::noteAuthors
virtual QStringList noteAuthors() const
Definition: catalogstorage.h:89
CatalogPrivate::_autoSaveRecovered
bool _autoSaveRecovered
Definition: catalog_private.h:83
Catalog::numberOfEntries
int numberOfEntries() const
Definition: catalog.cpp:171
Catalog::targetDelete
void targetDelete(const DocPosition &pos, int count)
Definition: catalog.cpp:802
CatalogPrivate::_statesIndex
QVector< QLinkedList< int > > _statesIndex
Definition: catalog_private.h:95
DocPos
simpler version of DocPosition for use in QMap
Definition: pos.h:82
gettextexport.h
Catalog::source
QString source(const DocPosition &pos) const
Definition: catalog.h:95
CatalogStorage::targetDelete
virtual void targetDelete(const DocPosition &pos, int count)=0
edit operations used by undo/redo system and sync-mode
CatalogPrivate::_readOnly
bool _readOnly
Definition: catalog_private.h:85
Catalog::supportedMimeFilters
static QString supportedMimeFilters
Definition: catalog.h:259
CatalogStorage::allTools
virtual QMap< QString, Tool > allTools() const
Definition: catalogstorage.h:80
CatalogStorage::load
virtual int load(QIODevice *device)=0
gettextstorage.h
Catalog
This class represents a catalog It uses CatalogStorage interface to work with catalogs in different f...
Definition: catalog.h:74
Catalog::state
TargetState state(const DocPosition &pos) const
Definition: catalog.cpp:421
Catalog::sourceLangCode
QString sourceLangCode() const
Definition: catalog.cpp:466
CatalogStorage::capabilities
virtual int capabilities() const =0
Catalog::setBookmark
void setBookmark(uint, bool)
Definition: catalog.cpp:981
Catalog::mimetype
QString mimetype()
Definition: catalog.cpp:458
Catalog::states
static const char *const * states()
Definition: catalog.cpp:79
findNextInList
int findNextInList(const QLinkedList< int > &list, int index)
Definition: catalog.cpp:947
Catalog::Catalog
Catalog(QObject *parent)
Definition: catalog.cpp:102
gettextimport.h
Catalog::notes
QVector< Note > notes(const DocPosition &pos) const
Definition: catalog.cpp:228
Catalog::signalFileAutoSaveFailed
void signalFileAutoSaveFailed(const QString &)
Catalog::isEquivTrans
bool isEquivTrans(const DocPosition &) const
Definition: catalog.cpp:443
GettextCatalog::GettextStorage
Implementation of storage for Gettext PO.
Definition: gettextstorage.h:39
DOESNTEXIST
#define DOESNTEXIST
Definition: catalog.cpp:485
Catalog::sourceFiles
QStringList sourceFiles(const DocPosition &pos) const
Definition: catalog.cpp:306
Catalog::saveToUrl
bool saveToUrl(KUrl url)
Definition: catalog.cpp:612
CatalogPrivate
Definition: catalog_private.h:60
Catalog::updateApprovedEmptyIndexCache
void updateApprovedEmptyIndexCache()
Definition: catalog.cpp:347
CatalogStorage::numberOfPluralForms
int numberOfPluralForms() const
Definition: catalogstorage.h:57
TargetState
TargetState
Definition: state.h:30
CatalogStorage::state
virtual TargetState state(const DocPosition &) const
Definition: catalogstorage.h:135
Catalog::msgstr
virtual QString msgstr(const DocPosition &) const
Definition: catalog.cpp:195
QUndoCommand
Catalog::setLastModifiedPos
void setLastModifiedPos(const DocPosition &)
(EDITING) accessed from undo/redo code called BEFORE modification
Definition: catalog.cpp:780
Catalog::setPhase
QString setPhase(const DocPosition &pos, const QString &phase)
Definition: catalog.cpp:330
CatalogStorage::context
virtual QStringList context(const DocPosition &) const =0
Catalog::allTools
QMap< QString, Tool > allTools() const
Definition: catalog.cpp:400
AltTrans
Definition: alttrans.h:30
extensions
static const char *const extensions[]
Definition: catalog.cpp:72
CatalogStorage::targetDeleteTag
virtual InlineTag targetDeleteTag(const DocPosition &)
Definition: catalogstorage.h:77
InlineTag
data structure used to pass info about inline elements a XLIFF tag is represented by a TAGRANGE_IMAGE...
Definition: catalogstring.h:44
CatalogStorage::setPhase
virtual QString setPhase(const DocPosition &pos, const QString &phase)
Definition: catalogstorage.h:93
CatalogStorage::id
virtual QString id(const DocPosition &) const =0
entry id unique for this file
TM::UpdateJob
used to eliminate a lot of duplicate entries
Definition: jobs.h:196
Catalog::unitById
int unitById(const QString &id) const
Definition: catalog.cpp:453
closestState
TargetState closestState(bool approved, ProjectLocal::PersonRole role)
Definition: catalog.cpp:1002
CatalogPrivate::_altTransCatalogs
QLinkedList< Catalog * > _altTransCatalogs
Definition: catalog_private.h:98
MergeCatalog::loadFromUrl
int loadFromUrl(const KUrl &url)
Definition: mergecatalog.cpp:163
CatalogPrivate::_autoSaveDirty
bool _autoSaveDirty
Definition: catalog_private.h:82
CatalogStorage::isApproved
virtual bool isApproved(const DocPosition &) const
Definition: catalogstorage.h:133
MergeCatalog::copyToBaseCatalog
void copyToBaseCatalog(DocPosition &pos)
Definition: mergecatalog.cpp:263
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