author | ulf69 <ulf69> | 2004-10-20 00:14:50 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-20 00:14:50 (UTC) |
commit | 675831e02387f0f838f63c3ea9d51d9679d070c5 (patch) (unidiff) | |
tree | 760bdc02ea21a49a1ef39c9875e345dc9cd09fde | |
parent | a9119c4edc272815121ddc863963b5289bb95b13 (diff) | |
download | kdepimpi-675831e02387f0f838f63c3ea9d51d9679d070c5.zip kdepimpi-675831e02387f0f838f63c3ea9d51d9679d070c5.tar.gz kdepimpi-675831e02387f0f838f63c3ea9d51d9679d070c5.tar.bz2 |
removed some debugoutput.
removed configsettings for some unneeded operations in pwmanager config
-rw-r--r-- | microkde/kdeui/klistview.cpp | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/globalstuff.h | 4 | ||||
-rw-r--r-- | pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp | 7 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmprefs.h | 4 |
4 files changed, 9 insertions, 8 deletions
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 6477d11..5b50ba9 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -1688,385 +1688,385 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1688 | 1688 | ||
1689 | case Key_Next: | 1689 | case Key_Next: |
1690 | items=visibleHeight()/item->height(); | 1690 | items=visibleHeight()/item->height(); |
1691 | nextItem=item; | 1691 | nextItem=item; |
1692 | if (d->selectedBySimpleMove) | 1692 | if (d->selectedBySimpleMove) |
1693 | item->setSelected(false); | 1693 | item->setSelected(false); |
1694 | if (shiftOrCtrl) | 1694 | if (shiftOrCtrl) |
1695 | { | 1695 | { |
1696 | d->selectedBySimpleMove=false; | 1696 | d->selectedBySimpleMove=false; |
1697 | d->selectionDirection=1; | 1697 | d->selectionDirection=1; |
1698 | }; | 1698 | }; |
1699 | 1699 | ||
1700 | for (int i=0; i<items; i++) | 1700 | for (int i=0; i<items; i++) |
1701 | { | 1701 | { |
1702 | if (shiftOrCtrl) | 1702 | if (shiftOrCtrl) |
1703 | nextItem->setSelected(!nextItem->isSelected()); | 1703 | nextItem->setSelected(!nextItem->isSelected()); |
1704 | //the end | 1704 | //the end |
1705 | if ((i==items-1) || (nextItem->itemBelow()==0)) | 1705 | if ((i==items-1) || (nextItem->itemBelow()==0)) |
1706 | 1706 | ||
1707 | { | 1707 | { |
1708 | if (shiftOrCtrl) | 1708 | if (shiftOrCtrl) |
1709 | nextItem->setSelected(!nextItem->isSelected()); | 1709 | nextItem->setSelected(!nextItem->isSelected()); |
1710 | if (d->selectedBySimpleMove) | 1710 | if (d->selectedBySimpleMove) |
1711 | nextItem->setSelected(true); | 1711 | nextItem->setSelected(true); |
1712 | ensureItemVisible(nextItem); | 1712 | ensureItemVisible(nextItem); |
1713 | setCurrentItem(nextItem); | 1713 | setCurrentItem(nextItem); |
1714 | update(); | 1714 | update(); |
1715 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) | 1715 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) |
1716 | { | 1716 | { |
1717 | emit selectionChanged(); | 1717 | emit selectionChanged(); |
1718 | } | 1718 | } |
1719 | return; | 1719 | return; |
1720 | } | 1720 | } |
1721 | nextItem=nextItem->itemBelow(); | 1721 | nextItem=nextItem->itemBelow(); |
1722 | } | 1722 | } |
1723 | break; | 1723 | break; |
1724 | 1724 | ||
1725 | case Key_Prior: | 1725 | case Key_Prior: |
1726 | items=visibleHeight()/item->height(); | 1726 | items=visibleHeight()/item->height(); |
1727 | nextItem=item; | 1727 | nextItem=item; |
1728 | if (d->selectedBySimpleMove) | 1728 | if (d->selectedBySimpleMove) |
1729 | item->setSelected(false); | 1729 | item->setSelected(false); |
1730 | if (shiftOrCtrl) | 1730 | if (shiftOrCtrl) |
1731 | { | 1731 | { |
1732 | d->selectionDirection=-1; | 1732 | d->selectionDirection=-1; |
1733 | d->selectedBySimpleMove=false; | 1733 | d->selectedBySimpleMove=false; |
1734 | }; | 1734 | }; |
1735 | 1735 | ||
1736 | for (int i=0; i<items; i++) | 1736 | for (int i=0; i<items; i++) |
1737 | { | 1737 | { |
1738 | if ((nextItem!=item) &&(shiftOrCtrl)) | 1738 | if ((nextItem!=item) &&(shiftOrCtrl)) |
1739 | nextItem->setSelected(!nextItem->isSelected()); | 1739 | nextItem->setSelected(!nextItem->isSelected()); |
1740 | //the end | 1740 | //the end |
1741 | if ((i==items-1) || (nextItem->itemAbove()==0)) | 1741 | if ((i==items-1) || (nextItem->itemAbove()==0)) |
1742 | 1742 | ||
1743 | { | 1743 | { |
1744 | if (d->selectedBySimpleMove) | 1744 | if (d->selectedBySimpleMove) |
1745 | nextItem->setSelected(true); | 1745 | nextItem->setSelected(true); |
1746 | ensureItemVisible(nextItem); | 1746 | ensureItemVisible(nextItem); |
1747 | setCurrentItem(nextItem); | 1747 | setCurrentItem(nextItem); |
1748 | update(); | 1748 | update(); |
1749 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) | 1749 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) |
1750 | { | 1750 | { |
1751 | emit selectionChanged(); | 1751 | emit selectionChanged(); |
1752 | } | 1752 | } |
1753 | return; | 1753 | return; |
1754 | } | 1754 | } |
1755 | nextItem=nextItem->itemAbove(); | 1755 | nextItem=nextItem->itemAbove(); |
1756 | } | 1756 | } |
1757 | break; | 1757 | break; |
1758 | 1758 | ||
1759 | case Key_Minus: | 1759 | case Key_Minus: |
1760 | if ( item->isOpen() ) | 1760 | if ( item->isOpen() ) |
1761 | setOpen( item, FALSE ); | 1761 | setOpen( item, FALSE ); |
1762 | break; | 1762 | break; |
1763 | case Key_Plus: | 1763 | case Key_Plus: |
1764 | if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) | 1764 | if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) |
1765 | setOpen( item, TRUE ); | 1765 | setOpen( item, TRUE ); |
1766 | break; | 1766 | break; |
1767 | default: | 1767 | default: |
1768 | bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) | 1768 | bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) |
1769 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); | 1769 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); |
1770 | 1770 | ||
1771 | bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); | 1771 | bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); |
1772 | if (realKey && selectCurrentItem) | 1772 | if (realKey && selectCurrentItem) |
1773 | item->setSelected(false); | 1773 | item->setSelected(false); |
1774 | //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) | 1774 | //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) |
1775 | QListView::SelectionMode oldSelectionMode = selectionMode(); | 1775 | QListView::SelectionMode oldSelectionMode = selectionMode(); |
1776 | setSelectionMode (QListView::Multi); | 1776 | setSelectionMode (QListView::Multi); |
1777 | QListView::keyPressEvent (e); | 1777 | QListView::keyPressEvent (e); |
1778 | setSelectionMode (oldSelectionMode); | 1778 | setSelectionMode (oldSelectionMode); |
1779 | if (realKey && selectCurrentItem) | 1779 | if (realKey && selectCurrentItem) |
1780 | { | 1780 | { |
1781 | currentItem()->setSelected(true); | 1781 | currentItem()->setSelected(true); |
1782 | emitSelectionChanged=TRUE; | 1782 | emitSelectionChanged=TRUE; |
1783 | } | 1783 | } |
1784 | repaintItem2=currentItem(); | 1784 | repaintItem2=currentItem(); |
1785 | if (realKey) | 1785 | if (realKey) |
1786 | visItem=currentItem(); | 1786 | visItem=currentItem(); |
1787 | break; | 1787 | break; |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | if (visItem) | 1790 | if (visItem) |
1791 | ensureItemVisible(visItem); | 1791 | ensureItemVisible(visItem); |
1792 | 1792 | ||
1793 | QRect ir; | 1793 | QRect ir; |
1794 | if (repaintItem1) | 1794 | if (repaintItem1) |
1795 | ir = ir.unite( itemRect(repaintItem1) ); | 1795 | ir = ir.unite( itemRect(repaintItem1) ); |
1796 | if (repaintItem2) | 1796 | if (repaintItem2) |
1797 | ir = ir.unite( itemRect(repaintItem2) ); | 1797 | ir = ir.unite( itemRect(repaintItem2) ); |
1798 | 1798 | ||
1799 | if ( !ir.isEmpty() ) | 1799 | if ( !ir.isEmpty() ) |
1800 | { // rectangle to be repainted | 1800 | { // rectangle to be repainted |
1801 | if ( ir.x() < 0 ) | 1801 | if ( ir.x() < 0 ) |
1802 | ir.moveBy( -ir.x(), 0 ); | 1802 | ir.moveBy( -ir.x(), 0 ); |
1803 | viewport()->repaint( ir, FALSE ); | 1803 | viewport()->repaint( ir, FALSE ); |
1804 | } | 1804 | } |
1805 | /*if (repaintItem1) | 1805 | /*if (repaintItem1) |
1806 | repaintItem1->repaint(); | 1806 | repaintItem1->repaint(); |
1807 | if (repaintItem2) | 1807 | if (repaintItem2) |
1808 | repaintItem2->repaint();*/ | 1808 | repaintItem2->repaint();*/ |
1809 | update(); | 1809 | update(); |
1810 | if (emitSelectionChanged) | 1810 | if (emitSelectionChanged) |
1811 | emit selectionChanged(); | 1811 | emit selectionChanged(); |
1812 | } | 1812 | } |
1813 | 1813 | ||
1814 | void KListView::setSelectionModeExt (SelectionModeExt mode) | 1814 | void KListView::setSelectionModeExt (SelectionModeExt mode) |
1815 | { | 1815 | { |
1816 | d->selectionMode = mode; | 1816 | d->selectionMode = mode; |
1817 | 1817 | ||
1818 | switch (mode) | 1818 | switch (mode) |
1819 | { | 1819 | { |
1820 | case Single: | 1820 | case Single: |
1821 | case Multi: | 1821 | case Multi: |
1822 | case Extended: | 1822 | case Extended: |
1823 | case NoSelection: | 1823 | case NoSelection: |
1824 | setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); | 1824 | setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); |
1825 | break; | 1825 | break; |
1826 | 1826 | ||
1827 | case FileManager: | 1827 | case FileManager: |
1828 | setSelectionMode (QListView::Extended); | 1828 | setSelectionMode (QListView::Extended); |
1829 | break; | 1829 | break; |
1830 | 1830 | ||
1831 | default: | 1831 | default: |
1832 | kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; | 1832 | kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; |
1833 | break; | 1833 | break; |
1834 | } | 1834 | } |
1835 | } | 1835 | } |
1836 | 1836 | ||
1837 | KListView::SelectionModeExt KListView::selectionModeExt () const | 1837 | KListView::SelectionModeExt KListView::selectionModeExt () const |
1838 | { | 1838 | { |
1839 | return d->selectionMode; | 1839 | return d->selectionMode; |
1840 | } | 1840 | } |
1841 | 1841 | ||
1842 | int KListView::itemIndex( const QListViewItem *item ) const | 1842 | int KListView::itemIndex( const QListViewItem *item ) const |
1843 | { | 1843 | { |
1844 | if ( !item ) | 1844 | if ( !item ) |
1845 | return -1; | 1845 | return -1; |
1846 | 1846 | ||
1847 | if ( item == firstChild() ) | 1847 | if ( item == firstChild() ) |
1848 | return 0; | 1848 | return 0; |
1849 | else { | 1849 | else { |
1850 | QListViewItemIterator it(firstChild()); | 1850 | QListViewItemIterator it(firstChild()); |
1851 | uint j = 0; | 1851 | uint j = 0; |
1852 | for (; it.current() && it.current() != item; ++it, ++j ); | 1852 | for (; it.current() && it.current() != item; ++it, ++j ); |
1853 | 1853 | ||
1854 | if( !it.current() ) | 1854 | if( !it.current() ) |
1855 | return -1; | 1855 | return -1; |
1856 | 1856 | ||
1857 | return j; | 1857 | return j; |
1858 | } | 1858 | } |
1859 | } | 1859 | } |
1860 | 1860 | ||
1861 | QListViewItem* KListView::itemAtIndex(int index) | 1861 | QListViewItem* KListView::itemAtIndex(int index) |
1862 | { | 1862 | { |
1863 | if (index<0) | 1863 | if (index<0) |
1864 | return 0; | 1864 | return 0; |
1865 | 1865 | ||
1866 | int j(0); | 1866 | int j(0); |
1867 | for (QListViewItemIterator it=firstChild(); it.current(); it++) | 1867 | for (QListViewItemIterator it=firstChild(); it.current(); it++) |
1868 | { | 1868 | { |
1869 | if (j==index) | 1869 | if (j==index) |
1870 | return it.current(); | 1870 | return it.current(); |
1871 | j++; | 1871 | j++; |
1872 | }; | 1872 | }; |
1873 | return 0; | 1873 | return 0; |
1874 | } | 1874 | } |
1875 | 1875 | ||
1876 | 1876 | ||
1877 | void KListView::emitContextMenu (KListView*, QListViewItem* i) | 1877 | void KListView::emitContextMenu (KListView*, QListViewItem* i) |
1878 | { | 1878 | { |
1879 | QPoint p; | 1879 | QPoint p; |
1880 | qDebug("KListView::emitContextMenu "); | 1880 | // qDebug("KListView::emitContextMenu "); |
1881 | 1881 | ||
1882 | if (i) | 1882 | if (i) |
1883 | p = viewport()->mapToGlobal(itemRect(i).center()); | 1883 | p = viewport()->mapToGlobal(itemRect(i).center()); |
1884 | else | 1884 | else |
1885 | p = mapToGlobal(rect().center()); | 1885 | p = mapToGlobal(rect().center()); |
1886 | 1886 | ||
1887 | emit contextMenu (this, i, p); | 1887 | emit contextMenu (this, i, p); |
1888 | } | 1888 | } |
1889 | 1889 | ||
1890 | void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) | 1890 | void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) |
1891 | { | 1891 | { |
1892 | qDebug("KListView::emitContextMenu col"); | 1892 | qDebug("KListView::emitContextMenu col"); |
1893 | emit contextRequest( i, p, col ); | 1893 | emit contextRequest( i, p, col ); |
1894 | emit contextMenu (this, i, p); | 1894 | emit contextMenu (this, i, p); |
1895 | } | 1895 | } |
1896 | 1896 | ||
1897 | void KListView::setAcceptDrops (bool val) | 1897 | void KListView::setAcceptDrops (bool val) |
1898 | { | 1898 | { |
1899 | QListView::setAcceptDrops (val); | 1899 | QListView::setAcceptDrops (val); |
1900 | viewport()->setAcceptDrops (val); | 1900 | viewport()->setAcceptDrops (val); |
1901 | } | 1901 | } |
1902 | 1902 | ||
1903 | int KListView::dropVisualizerWidth () const | 1903 | int KListView::dropVisualizerWidth () const |
1904 | { | 1904 | { |
1905 | return d->mDropVisualizerWidth; | 1905 | return d->mDropVisualizerWidth; |
1906 | } | 1906 | } |
1907 | 1907 | ||
1908 | 1908 | ||
1909 | void KListView::viewportPaintEvent(QPaintEvent *e) | 1909 | void KListView::viewportPaintEvent(QPaintEvent *e) |
1910 | { | 1910 | { |
1911 | QListView::viewportPaintEvent(e); | 1911 | QListView::viewportPaintEvent(e); |
1912 | 1912 | ||
1913 | if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) | 1913 | if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) |
1914 | { | 1914 | { |
1915 | QPainter painter(viewport()); | 1915 | QPainter painter(viewport()); |
1916 | 1916 | ||
1917 | // This is where we actually draw the drop-visualizer | 1917 | // This is where we actually draw the drop-visualizer |
1918 | painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); | 1918 | painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); |
1919 | } | 1919 | } |
1920 | if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) | 1920 | if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) |
1921 | { | 1921 | { |
1922 | QPainter painter(viewport()); | 1922 | QPainter painter(viewport()); |
1923 | 1923 | ||
1924 | qDebug("KListView::viewportPaintEvent has to be verified"); | 1924 | qDebug("KListView::viewportPaintEvent has to be verified"); |
1925 | 1925 | ||
1926 | // This is where we actually draw the drop-highlighter | 1926 | // This is where we actually draw the drop-highlighter |
1927 | //US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), | 1927 | //US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), |
1928 | //US QStyle::Style_FocusAtBorder); | 1928 | //US QStyle::Style_FocusAtBorder); |
1929 | 1929 | ||
1930 | //LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); | 1930 | //LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); |
1931 | 1931 | ||
1932 | 1932 | ||
1933 | } | 1933 | } |
1934 | } | 1934 | } |
1935 | 1935 | ||
1936 | void KListView::setFullWidth() | 1936 | void KListView::setFullWidth() |
1937 | { | 1937 | { |
1938 | setFullWidth(true); | 1938 | setFullWidth(true); |
1939 | } | 1939 | } |
1940 | 1940 | ||
1941 | void KListView::setFullWidth(bool fullWidth) | 1941 | void KListView::setFullWidth(bool fullWidth) |
1942 | { | 1942 | { |
1943 | d->fullWidth = fullWidth; | 1943 | d->fullWidth = fullWidth; |
1944 | //US header()->setStretchEnabled(fullWidth, columns()-1); | 1944 | //US header()->setStretchEnabled(fullWidth, columns()-1); |
1945 | } | 1945 | } |
1946 | 1946 | ||
1947 | bool KListView::fullWidth() const | 1947 | bool KListView::fullWidth() const |
1948 | { | 1948 | { |
1949 | return d->fullWidth; | 1949 | return d->fullWidth; |
1950 | } | 1950 | } |
1951 | 1951 | ||
1952 | int KListView::addColumn(const QString& label, int width) | 1952 | int KListView::addColumn(const QString& label, int width) |
1953 | { | 1953 | { |
1954 | int result = QListView::addColumn(label, width); | 1954 | int result = QListView::addColumn(label, width); |
1955 | if (d->fullWidth) { | 1955 | if (d->fullWidth) { |
1956 | //US header()->setStretchEnabled(false, columns()-2); | 1956 | //US header()->setStretchEnabled(false, columns()-2); |
1957 | //US header()->setStretchEnabled(true, columns()-1); | 1957 | //US header()->setStretchEnabled(true, columns()-1); |
1958 | } | 1958 | } |
1959 | return result; | 1959 | return result; |
1960 | } | 1960 | } |
1961 | 1961 | ||
1962 | int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) | 1962 | int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) |
1963 | { | 1963 | { |
1964 | int result = QListView::addColumn(iconset, label, width); | 1964 | int result = QListView::addColumn(iconset, label, width); |
1965 | if (d->fullWidth) { | 1965 | if (d->fullWidth) { |
1966 | //US header()->setStretchEnabled(false, columns()-2); | 1966 | //US header()->setStretchEnabled(false, columns()-2); |
1967 | //US header()->setStretchEnabled(true, columns()-1); | 1967 | //US header()->setStretchEnabled(true, columns()-1); |
1968 | } | 1968 | } |
1969 | return result; | 1969 | return result; |
1970 | } | 1970 | } |
1971 | 1971 | ||
1972 | void KListView::removeColumn(int index) | 1972 | void KListView::removeColumn(int index) |
1973 | { | 1973 | { |
1974 | QListView::removeColumn(index); | 1974 | QListView::removeColumn(index); |
1975 | //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); | 1975 | //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); |
1976 | } | 1976 | } |
1977 | 1977 | ||
1978 | void KListView::viewportResizeEvent(QResizeEvent* e) | 1978 | void KListView::viewportResizeEvent(QResizeEvent* e) |
1979 | { | 1979 | { |
1980 | QListView::viewportResizeEvent(e); | 1980 | QListView::viewportResizeEvent(e); |
1981 | } | 1981 | } |
1982 | 1982 | ||
1983 | const QColor &KListView::alternateBackground() const | 1983 | const QColor &KListView::alternateBackground() const |
1984 | { | 1984 | { |
1985 | return d->alternateBackground; | 1985 | return d->alternateBackground; |
1986 | } | 1986 | } |
1987 | 1987 | ||
1988 | void KListView::setAlternateBackground(const QColor &c) | 1988 | void KListView::setAlternateBackground(const QColor &c) |
1989 | { | 1989 | { |
1990 | d->alternateBackground = c; | 1990 | d->alternateBackground = c; |
1991 | repaint(); | 1991 | repaint(); |
1992 | } | 1992 | } |
1993 | 1993 | ||
1994 | void KListView::saveLayout(KConfig *config, const QString &group) const | 1994 | void KListView::saveLayout(KConfig *config, const QString &group) const |
1995 | { | 1995 | { |
1996 | KConfigGroupSaver saver(config, group); | 1996 | KConfigGroupSaver saver(config, group); |
1997 | QStringList widths, order; | 1997 | QStringList widths, order; |
1998 | for (int i = 0; i < columns(); ++i) | 1998 | for (int i = 0; i < columns(); ++i) |
1999 | { | 1999 | { |
2000 | widths << QString::number(columnWidth(i)); | 2000 | widths << QString::number(columnWidth(i)); |
2001 | order << QString::number(header()->mapToIndex(i)); | 2001 | order << QString::number(header()->mapToIndex(i)); |
2002 | } | 2002 | } |
2003 | config->writeEntry("ColumnWidths", widths); | 2003 | config->writeEntry("ColumnWidths", widths); |
2004 | config->writeEntry("ColumnOrder", order); | 2004 | config->writeEntry("ColumnOrder", order); |
2005 | config->writeEntry("SortColumn", d->sortColumn); | 2005 | config->writeEntry("SortColumn", d->sortColumn); |
2006 | config->writeEntry("SortAscending", d->sortAscending); | 2006 | config->writeEntry("SortAscending", d->sortAscending); |
2007 | } | 2007 | } |
2008 | 2008 | ||
2009 | void KListView::restoreLayout(KConfig *config, const QString &group) | 2009 | void KListView::restoreLayout(KConfig *config, const QString &group) |
2010 | { | 2010 | { |
2011 | KConfigGroupSaver saver(config, group); | 2011 | KConfigGroupSaver saver(config, group); |
2012 | QStringList cols = config->readListEntry("ColumnWidths"); | 2012 | QStringList cols = config->readListEntry("ColumnWidths"); |
2013 | int i = 0; | 2013 | int i = 0; |
2014 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) | 2014 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) |
2015 | setColumnWidth(i++, (*it).toInt()); | 2015 | setColumnWidth(i++, (*it).toInt()); |
2016 | 2016 | ||
2017 | cols = config->readListEntry("ColumnOrder"); | 2017 | cols = config->readListEntry("ColumnOrder"); |
2018 | i = 0; | 2018 | i = 0; |
2019 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) | 2019 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) |
2020 | header()->moveSection(i++, (*it).toInt()); | 2020 | header()->moveSection(i++, (*it).toInt()); |
2021 | 2021 | ||
2022 | /*US I changed the following code, because hasKey is not available. | 2022 | /*US I changed the following code, because hasKey is not available. |
2023 | !!! check if my version is correct | 2023 | !!! check if my version is correct |
2024 | if (config->hasKey("SortColumn")) | 2024 | if (config->hasKey("SortColumn")) |
2025 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); | 2025 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); |
2026 | */ | 2026 | */ |
2027 | QStringList langLst = config->readListEntry( "SortColumn" ); | 2027 | QStringList langLst = config->readListEntry( "SortColumn" ); |
2028 | if (!langLst.isEmpty()) | 2028 | if (!langLst.isEmpty()) |
2029 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); | 2029 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); |
2030 | } | 2030 | } |
2031 | 2031 | ||
2032 | void KListView::setSorting(int column, bool ascending) | 2032 | void KListView::setSorting(int column, bool ascending) |
2033 | { | 2033 | { |
2034 | d->sortColumn = column; | 2034 | d->sortColumn = column; |
2035 | d->sortAscending = ascending; | 2035 | d->sortAscending = ascending; |
2036 | QListView::setSorting(column, ascending); | 2036 | QListView::setSorting(column, ascending); |
2037 | } | 2037 | } |
2038 | 2038 | ||
2039 | int KListView::columnSorted(void) const | 2039 | int KListView::columnSorted(void) const |
2040 | { | 2040 | { |
2041 | return d->sortColumn; | 2041 | return d->sortColumn; |
2042 | } | 2042 | } |
2043 | 2043 | ||
2044 | bool KListView::ascendingSort(void) const | 2044 | bool KListView::ascendingSort(void) const |
2045 | { | 2045 | { |
2046 | return d->sortAscending; | 2046 | return d->sortAscending; |
2047 | } | 2047 | } |
2048 | 2048 | ||
2049 | KListViewItem::KListViewItem(QListView *parent) | 2049 | KListViewItem::KListViewItem(QListView *parent) |
2050 | : QListViewItem(parent) | 2050 | : QListViewItem(parent) |
2051 | { | 2051 | { |
2052 | init(); | 2052 | init(); |
2053 | } | 2053 | } |
2054 | 2054 | ||
2055 | KListViewItem::KListViewItem(QListViewItem *parent) | 2055 | KListViewItem::KListViewItem(QListViewItem *parent) |
2056 | : QListViewItem(parent) | 2056 | : QListViewItem(parent) |
2057 | { | 2057 | { |
2058 | init(); | 2058 | init(); |
2059 | } | 2059 | } |
2060 | 2060 | ||
2061 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) | 2061 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) |
2062 | : QListViewItem(parent, after) | 2062 | : QListViewItem(parent, after) |
2063 | { | 2063 | { |
2064 | init(); | 2064 | init(); |
2065 | } | 2065 | } |
2066 | 2066 | ||
2067 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) | 2067 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) |
2068 | : QListViewItem(parent, after) | 2068 | : QListViewItem(parent, after) |
2069 | { | 2069 | { |
2070 | init(); | 2070 | init(); |
2071 | } | 2071 | } |
2072 | 2072 | ||
diff --git a/pwmanager/pwmanager/globalstuff.h b/pwmanager/pwmanager/globalstuff.h index 4f70f68..090fcda 100644 --- a/pwmanager/pwmanager/globalstuff.h +++ b/pwmanager/pwmanager/globalstuff.h | |||
@@ -1,134 +1,134 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef __GLOBALSTUFF_H | 20 | #ifndef __GLOBALSTUFF_H |
21 | #define __GLOBALSTUFF_H | 21 | #define __GLOBALSTUFF_H |
22 | 22 | ||
23 | #ifndef PWM_EMBEDDED | 23 | #ifndef PWM_EMBEDDED |
24 | #include "config.h" | 24 | #include "config.h" |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include "compiler.h" | 27 | #include "compiler.h" |
28 | 28 | ||
29 | //US BUG: the following code caused compile errors with certain gcccompilers (2.95). | 29 | //US BUG: the following code caused compile errors with certain gcccompilers (2.95). |
30 | // Because of that I replaced it with a Qt version, which should do the same. | 30 | // Because of that I replaced it with a Qt version, which should do the same. |
31 | #include <string> | 31 | #include <string> |
32 | 32 | ||
33 | #ifndef PWM_EMBEDDED | 33 | #ifndef PWM_EMBEDDED |
34 | #include <sstream> | 34 | #include <sstream> |
35 | #else | 35 | #else |
36 | #include <qstring.h> | 36 | #include <qstring.h> |
37 | #include <qtextstream.h> | 37 | #include <qtextstream.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #ifndef CONFIG_KEYCARD | 40 | #ifndef CONFIG_KEYCARD |
41 | class QWidget; | 41 | class QWidget; |
42 | void no_keycard_support_msg_box(QWidget *parentWidget); | 42 | void no_keycard_support_msg_box(QWidget *parentWidget); |
43 | #endif // CONFIG_KEYCARD | 43 | #endif // CONFIG_KEYCARD |
44 | 44 | ||
45 | #ifdef PROG_NAME | 45 | #ifdef PROG_NAME |
46 | # undef PROG_NAME | 46 | # undef PROG_NAME |
47 | #endif | 47 | #endif |
48 | #define PROG_NAME"PwManager-MicroKDE" | 48 | #define PROG_NAME"PwM/Pi" |
49 | 49 | ||
50 | #ifdef PACKAGE_NAME | 50 | #ifdef PACKAGE_NAME |
51 | # undef PACKAGE_NAME | 51 | # undef PACKAGE_NAME |
52 | #endif | 52 | #endif |
53 | #define PACKAGE_NAME"pwmanager-microkde" | 53 | #define PACKAGE_NAME"pwm-pi" |
54 | 54 | ||
55 | #ifdef PACKAGE_VER | 55 | #ifdef PACKAGE_VER |
56 | # undef PACKAGE_VER | 56 | # undef PACKAGE_VER |
57 | #endif | 57 | #endif |
58 | #define PACKAGE_VER"1.0.1" | 58 | #define PACKAGE_VER"1.0.1" |
59 | 59 | ||
60 | #ifdef CONFIG_DEBUG | 60 | #ifdef CONFIG_DEBUG |
61 | # define PWM_DEBUG | 61 | # define PWM_DEBUG |
62 | #else | 62 | #else |
63 | # undef PWM_DEBUG | 63 | # undef PWM_DEBUG |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #ifdef QT_MAKE_VERSION | 66 | #ifdef QT_MAKE_VERSION |
67 | # undef QT_MAKE_VERSION | 67 | # undef QT_MAKE_VERSION |
68 | #endif | 68 | #endif |
69 | #define QT_MAKE_VERSION(a,b,c)(((a) << 16) | ((b) << 8) | (c)) | 69 | #define QT_MAKE_VERSION(a,b,c)(((a) << 16) | ((b) << 8) | (c)) |
70 | 70 | ||
71 | /** remove "unused parameter" warnings */ | 71 | /** remove "unused parameter" warnings */ |
72 | #ifdef PARAM_UNUSED | 72 | #ifdef PARAM_UNUSED |
73 | # undef PARAM_UNUSED | 73 | # undef PARAM_UNUSED |
74 | #endif | 74 | #endif |
75 | #define PARAM_UNUSED(x)(void)x | 75 | #define PARAM_UNUSED(x)(void)x |
76 | 76 | ||
77 | /** return the number of elements in an array */ | 77 | /** return the number of elements in an array */ |
78 | #ifdef array_size | 78 | #ifdef array_size |
79 | # undef array_size | 79 | # undef array_size |
80 | #endif | 80 | #endif |
81 | #define array_size(x)(sizeof(x) / sizeof((x)[0])) | 81 | #define array_size(x)(sizeof(x) / sizeof((x)[0])) |
82 | 82 | ||
83 | //US BUG: the following code caused compile errors with certain gcccompilers (2.95). | 83 | //US BUG: the following code caused compile errors with certain gcccompilers (2.95). |
84 | // Because of that I replaced it with a Qt version, which should do the same. | 84 | // Because of that I replaced it with a Qt version, which should do the same. |
85 | #ifndef PWM_EMBEDDED | 85 | #ifndef PWM_EMBEDDED |
86 | /** convert something to string using ostringstream */ | 86 | /** convert something to string using ostringstream */ |
87 | template <class T> inline | 87 | template <class T> inline |
88 | std::string tostr(const T &t) | 88 | std::string tostr(const T &t) |
89 | { | 89 | { |
90 | std::ostringstream s; | 90 | std::ostringstream s; |
91 | s << t; | 91 | s << t; |
92 | return s.str(); | 92 | return s.str(); |
93 | } | 93 | } |
94 | #else | 94 | #else |
95 | /** convert something to string using ostringstream */ | 95 | /** convert something to string using ostringstream */ |
96 | template <class T> inline | 96 | template <class T> inline |
97 | std::string tostr(const T &t) | 97 | std::string tostr(const T &t) |
98 | { | 98 | { |
99 | QString result; | 99 | QString result; |
100 | QTextOStream(&result) << t; | 100 | QTextOStream(&result) << t; |
101 | return result.latin1(); | 101 | return result.latin1(); |
102 | } | 102 | } |
103 | #endif | 103 | #endif |
104 | 104 | ||
105 | /** delete the memory and NULL the pointer */ | 105 | /** delete the memory and NULL the pointer */ |
106 | template<class T> inline | 106 | template<class T> inline |
107 | void delete_and_null(T *&p) | 107 | void delete_and_null(T *&p) |
108 | { | 108 | { |
109 | delete p; | 109 | delete p; |
110 | p = 0; | 110 | p = 0; |
111 | } | 111 | } |
112 | /** delete the memory if the pointer isn't a NULL pointer */ | 112 | /** delete the memory if the pointer isn't a NULL pointer */ |
113 | template<class T> inline | 113 | template<class T> inline |
114 | void delete_ifnot_null(T *&p) | 114 | void delete_ifnot_null(T *&p) |
115 | { | 115 | { |
116 | if (p) | 116 | if (p) |
117 | delete_and_null(p); | 117 | delete_and_null(p); |
118 | } | 118 | } |
119 | 119 | ||
120 | template<class T> inline | 120 | template<class T> inline |
121 | void delete_and_null_array(T *&p) | 121 | void delete_and_null_array(T *&p) |
122 | { | 122 | { |
123 | delete [] p; | 123 | delete [] p; |
124 | p = 0; | 124 | p = 0; |
125 | } | 125 | } |
126 | 126 | ||
127 | template<class T> inline | 127 | template<class T> inline |
128 | void delete_ifnot_null_array(T *&p) | 128 | void delete_ifnot_null_array(T *&p) |
129 | { | 129 | { |
130 | if (p) | 130 | if (p) |
131 | delete_and_null_array(p); | 131 | delete_and_null_array(p); |
132 | } | 132 | } |
133 | 133 | ||
134 | #endif // GLOBALSTUFF_H | 134 | #endif // GLOBALSTUFF_H |
diff --git a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp index 720dfcc..26b9708 100644 --- a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp +++ b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp | |||
@@ -24,327 +24,328 @@ | |||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qspinbox.h> | 32 | #include <qspinbox.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qvbox.h> | 35 | #include <qvbox.h> |
36 | 36 | ||
37 | #include <kconfig.h> | 37 | #include <kconfig.h> |
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <kdialog.h> | 39 | #include <kdialog.h> |
40 | #include <klistview.h> | 40 | #include <klistview.h> |
41 | #include <klocale.h> | 41 | #include <klocale.h> |
42 | #include <kglobal.h> | 42 | #include <kglobal.h> |
43 | #include <kmessagebox.h> | 43 | #include <kmessagebox.h> |
44 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
45 | #include <kio/kfile/kurlrequester.h> | 45 | #include <kio/kfile/kurlrequester.h> |
46 | 46 | ||
47 | #include "pwmprefs.h" | 47 | #include "pwmprefs.h" |
48 | 48 | ||
49 | #include "pwmconfigwidget.h" | 49 | #include "pwmconfigwidget.h" |
50 | #include "pwmexception.h" | 50 | #include "pwmexception.h" |
51 | 51 | ||
52 | PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *name ) | 52 | PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *name ) |
53 | : KPrefsWidget(prefs, parent, name ) | 53 | : KPrefsWidget(prefs, parent, name ) |
54 | { | 54 | { |
55 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 55 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
56 | KDialog::spacingHint() ); | 56 | KDialog::spacingHint() ); |
57 | 57 | ||
58 | QTabWidget *tabWidget = new QTabWidget( this ); | 58 | QTabWidget *tabWidget = new QTabWidget( this ); |
59 | topLayout->addWidget( tabWidget ); | 59 | topLayout->addWidget( tabWidget ); |
60 | 60 | ||
61 | // windowsStyle page | 61 | // windowsStyle page |
62 | ////////////////////////////////////////////////////// | 62 | ////////////////////////////////////////////////////// |
63 | QWidget *windowStylePage = new QWidget( this ); | 63 | QWidget *windowStylePage = new QWidget( this ); |
64 | QGridLayout *windowStyleLayout = new QGridLayout( windowStylePage, 3, 3); | 64 | QGridLayout *windowStyleLayout = new QGridLayout( windowStylePage, 3, 3); |
65 | 65 | ||
66 | int i = 0; | 66 | int i = 0; |
67 | KPrefsWidRadios * windowStyle = addWidRadios(i18n("Window-style:") ,&(prefs->mMainViewStyle), windowStylePage); | 67 | KPrefsWidRadios * windowStyle = addWidRadios(i18n("Window-style:") ,&(prefs->mMainViewStyle), windowStylePage); |
68 | windowStyle->addRadio(i18n("Category on top")); | 68 | windowStyle->addRadio(i18n("Category on top")); |
69 | windowStyle->addRadio(i18n("Category-list left/top")); | 69 | windowStyle->addRadio(i18n("Category-list left/top")); |
70 | windowStyleLayout->addMultiCellWidget( (QWidget*)windowStyle->groupBox(),i,i,0,2); | 70 | windowStyleLayout->addMultiCellWidget( (QWidget*)windowStyle->groupBox(),i,i,0,2); |
71 | ++i; | 71 | ++i; |
72 | 72 | ||
73 | QLabel* lab = new QLabel(i18n("<b>Font for Password entries:</b>"), windowStylePage); | 73 | QLabel* lab = new QLabel(i18n("<b>Font for Password entries:</b>"), windowStylePage); |
74 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); | 74 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); |
75 | 75 | ||
76 | 76 | ||
77 | ++i; | 77 | ++i; |
78 | 78 | ||
79 | KPrefsWidFont *selEntrFont = | 79 | KPrefsWidFont *selEntrFont = |
80 | addWidFont(i18n("Password"),i18n("Font:"), | 80 | addWidFont(i18n("Password"),i18n("Font:"), |
81 | &(prefs->mEntryFont),windowStylePage); | 81 | &(prefs->mEntryFont),windowStylePage); |
82 | windowStyleLayout->addWidget(selEntrFont->label(),i,0); | 82 | windowStyleLayout->addWidget(selEntrFont->label(),i,0); |
83 | windowStyleLayout->addWidget(selEntrFont->preview(),i,1); | 83 | windowStyleLayout->addWidget(selEntrFont->preview(),i,1); |
84 | windowStyleLayout->addWidget(selEntrFont->button(),i,2); | 84 | windowStyleLayout->addWidget(selEntrFont->button(),i,2); |
85 | ++i; | 85 | ++i; |
86 | lab = new QLabel(i18n(""), windowStylePage); | 86 | lab = new QLabel(i18n(""), windowStylePage); |
87 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); | 87 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); |
88 | 88 | ||
89 | // File page | 89 | // File page |
90 | ////////////////////////////////////////////////////// | 90 | ////////////////////////////////////////////////////// |
91 | QWidget *filePage = new QWidget( this ); | 91 | QWidget *filePage = new QWidget( this ); |
92 | QGridLayout *fileLayout = new QGridLayout( filePage, 3, 2); | 92 | QGridLayout *fileLayout = new QGridLayout( filePage, 3, 2); |
93 | 93 | ||
94 | i = 0; | 94 | i = 0; |
95 | QLabel* kcfg_compression_label = new QLabel(i18n("Compression:"), filePage); | 95 | QLabel* kcfg_compression_label = new QLabel(i18n("Compression:"), filePage); |
96 | fileLayout->addWidget(kcfg_compression_label,i,0); | 96 | fileLayout->addWidget(kcfg_compression_label,i,0); |
97 | kcfg_compression = new QComboBox(filePage, "kcfg_compression"); | 97 | kcfg_compression = new QComboBox(filePage, "kcfg_compression"); |
98 | kcfg_compression->insertItem(i18n("None")); | 98 | kcfg_compression->insertItem(i18n("None")); |
99 | kcfg_compression->insertItem(i18n("gzip")); | 99 | kcfg_compression->insertItem(i18n("gzip")); |
100 | //US not yet supported: kcfg_compression->insertItem(i18n("bzip2")); | 100 | //US not yet supported: kcfg_compression->insertItem(i18n("bzip2")); |
101 | fileLayout->addWidget( kcfg_compression,i,1); | 101 | fileLayout->addWidget( kcfg_compression,i,1); |
102 | ++i; | 102 | ++i; |
103 | 103 | ||
104 | QLabel* kcfg_crypt_label = new QLabel(i18n("Encryption:"), filePage); | 104 | QLabel* kcfg_crypt_label = new QLabel(i18n("Encryption:"), filePage); |
105 | fileLayout->addWidget(kcfg_crypt_label,i,0); | 105 | fileLayout->addWidget(kcfg_crypt_label,i,0); |
106 | kcfg_cryptAlgo = new QComboBox(filePage, "kcfg_cryptAlgo"); | 106 | kcfg_cryptAlgo = new QComboBox(filePage, "kcfg_cryptAlgo"); |
107 | kcfg_cryptAlgo->insertItem(i18n("Blowfish (128 bit)")); | 107 | kcfg_cryptAlgo->insertItem(i18n("Blowfish (128 bit)")); |
108 | #ifdef CONFIG_PWMANAGER_GCRY | 108 | #ifdef CONFIG_PWMANAGER_GCRY |
109 | kcfg_cryptAlgo->insertItem(i18n("AES-128, Rijndael (128 bit)")); | 109 | kcfg_cryptAlgo->insertItem(i18n("AES-128, Rijndael (128 bit)")); |
110 | kcfg_cryptAlgo->insertItem(i18n("AES-192, Rijndael (192 bit)")); | 110 | kcfg_cryptAlgo->insertItem(i18n("AES-192, Rijndael (192 bit)")); |
111 | kcfg_cryptAlgo->insertItem(i18n("AES-256, Rijndael (256 bit)")); | 111 | kcfg_cryptAlgo->insertItem(i18n("AES-256, Rijndael (256 bit)")); |
112 | kcfg_cryptAlgo->insertItem(i18n("Triple-DES (168 bit)")); | 112 | kcfg_cryptAlgo->insertItem(i18n("Triple-DES (168 bit)")); |
113 | kcfg_cryptAlgo->insertItem(i18n("Twofish (256 bit)")); | 113 | kcfg_cryptAlgo->insertItem(i18n("Twofish (256 bit)")); |
114 | kcfg_cryptAlgo->insertItem(i18n("Twofish-128 (128 bit)")); | 114 | kcfg_cryptAlgo->insertItem(i18n("Twofish-128 (128 bit)")); |
115 | #endif // CONFIG_PWMANAGER_GCRY | 115 | #endif // CONFIG_PWMANAGER_GCRY |
116 | fileLayout->addWidget( kcfg_cryptAlgo,i,1); | 116 | fileLayout->addWidget( kcfg_cryptAlgo,i,1); |
117 | ++i; | 117 | ++i; |
118 | 118 | ||
119 | QLabel* kcfg_hash_label = new QLabel(i18n("Hashing:"), filePage); | 119 | QLabel* kcfg_hash_label = new QLabel(i18n("Hashing:"), filePage); |
120 | fileLayout->addWidget(kcfg_hash_label,i,0); | 120 | fileLayout->addWidget(kcfg_hash_label,i,0); |
121 | kcfg_hashAlgo = new QComboBox(filePage, "kcfg_hashAlgo"); | 121 | kcfg_hashAlgo = new QComboBox(filePage, "kcfg_hashAlgo"); |
122 | kcfg_hashAlgo->insertItem(i18n("SHA-160, SHA1 (160 bit)")); | 122 | kcfg_hashAlgo->insertItem(i18n("SHA-160, SHA1 (160 bit)")); |
123 | #ifdef CONFIG_PWMANAGER_GCRY | 123 | #ifdef CONFIG_PWMANAGER_GCRY |
124 | kcfg_hashAlgo->insertItem(i18n("SHA-256 (256 bit)")); | 124 | kcfg_hashAlgo->insertItem(i18n("SHA-256 (256 bit)")); |
125 | kcfg_hashAlgo->insertItem(i18n("SHA-384 (384 bit)")); | 125 | kcfg_hashAlgo->insertItem(i18n("SHA-384 (384 bit)")); |
126 | kcfg_hashAlgo->insertItem(i18n("SHA-512 (512 bit)")); | 126 | kcfg_hashAlgo->insertItem(i18n("SHA-512 (512 bit)")); |
127 | kcfg_hashAlgo->insertItem(i18n("MD5 (128 bit)")); | 127 | kcfg_hashAlgo->insertItem(i18n("MD5 (128 bit)")); |
128 | kcfg_hashAlgo->insertItem(i18n("RIPE-MD-160 (160 bit)")); | 128 | kcfg_hashAlgo->insertItem(i18n("RIPE-MD-160 (160 bit)")); |
129 | kcfg_hashAlgo->insertItem(i18n("Tiger (192 bit)")); | 129 | kcfg_hashAlgo->insertItem(i18n("Tiger (192 bit)")); |
130 | #endif // CONFIG_PWMANAGER_GCRY | 130 | #endif // CONFIG_PWMANAGER_GCRY |
131 | fileLayout->addWidget( kcfg_hashAlgo,i,1); | 131 | fileLayout->addWidget( kcfg_hashAlgo,i,1); |
132 | ++i; | 132 | ++i; |
133 | 133 | ||
134 | permissionLineEdit = new QLineEdit(filePage); | 134 | permissionLineEdit = new QLineEdit(filePage); |
135 | QLabel* permissionLineLabel = new QLabel(permissionLineEdit, i18n("Permissions:"), filePage); | 135 | QLabel* permissionLineLabel = new QLabel(permissionLineEdit, i18n("Permissions:"), filePage); |
136 | fileLayout->addWidget(permissionLineLabel,i,0); | 136 | fileLayout->addWidget(permissionLineLabel,i,0); |
137 | fileLayout->addWidget(permissionLineEdit,i,1); | 137 | fileLayout->addWidget(permissionLineEdit,i,1); |
138 | ++i; | 138 | ++i; |
139 | 139 | ||
140 | KPrefsWidBool *sb = addWidBool(i18n("Make backup before saving"), | 140 | KPrefsWidBool *sb = addWidBool(i18n("Make backup before saving"), |
141 | &(prefs->mMakeFileBackup),filePage); | 141 | &(prefs->mMakeFileBackup),filePage); |
142 | fileLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 142 | fileLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
143 | ++i; | 143 | ++i; |
144 | 144 | ||
145 | // Timeout page | 145 | // Timeout page |
146 | ////////////////////////////////////////////////////// | 146 | ////////////////////////////////////////////////////// |
147 | QWidget *timeoutPage = new QWidget( this ); | 147 | QWidget *timeoutPage = new QWidget( this ); |
148 | QGridLayout *timeoutLayout = new QGridLayout( timeoutPage, 3, 2); | 148 | QGridLayout *timeoutLayout = new QGridLayout( timeoutPage, 3, 2); |
149 | 149 | ||
150 | i = 0; | 150 | i = 0; |
151 | pwTimeoutSpinBox = new QSpinBox( timeoutPage, "pwTimeoutSpinBox" ); | 151 | pwTimeoutSpinBox = new QSpinBox( timeoutPage, "pwTimeoutSpinBox" ); |
152 | QLabel* timeoutLabel = new QLabel(pwTimeoutSpinBox, i18n("Password timeout\n(timeout to hold password in\nmemory,so you don't have to\nre-enter it,if you\nalready have entered it)\n[set to 0 to disable]:"), timeoutPage); | 152 | QLabel* timeoutLabel = new QLabel(pwTimeoutSpinBox, i18n("Password timeout\n(timeout to hold password in\nmemory,so you don't have to\nre-enter it,if you\nalready have entered it)\n[set to 0 to disable]:"), timeoutPage); |
153 | timeoutLayout->addMultiCellWidget(timeoutLabel,i, i, 0 ,0); | 153 | timeoutLayout->addMultiCellWidget(timeoutLabel,i, i, 0 ,0); |
154 | timeoutLayout->addWidget(pwTimeoutSpinBox,i,1); | 154 | timeoutLayout->addWidget(pwTimeoutSpinBox,i,1); |
155 | ++i; | 155 | ++i; |
156 | 156 | ||
157 | lockTimeoutSpinBox = new QSpinBox( timeoutPage, "lockTimeoutSpinBox" ); | 157 | lockTimeoutSpinBox = new QSpinBox( timeoutPage, "lockTimeoutSpinBox" ); |
158 | QLabel* lockTimeoutLabel = new QLabel(lockTimeoutSpinBox, i18n("Auto-lock timeout\n(auto lock document after this\namount of seconds)\n[set to 0 to disable]:"), timeoutPage); | 158 | QLabel* lockTimeoutLabel = new QLabel(lockTimeoutSpinBox, i18n("Auto-lock timeout\n(auto lock document after this\namount of seconds)\n[set to 0 to disable]:"), timeoutPage); |
159 | timeoutLayout->addMultiCellWidget(lockTimeoutLabel,i, i, 0 ,0); | 159 | timeoutLayout->addMultiCellWidget(lockTimeoutLabel,i, i, 0 ,0); |
160 | timeoutLayout->addWidget(lockTimeoutSpinBox,i,1); | 160 | timeoutLayout->addWidget(lockTimeoutSpinBox,i,1); |
161 | ++i; | 161 | ++i; |
162 | 162 | ||
163 | sb = addWidBool(i18n("deep-lock on autolock"), | 163 | sb = addWidBool(i18n("deep-lock on autolock"), |
164 | &(prefs->mAutoDeeplock),timeoutPage); | 164 | &(prefs->mAutoDeeplock),timeoutPage); |
165 | timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 165 | timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
166 | ++i; | 166 | ++i; |
167 | 167 | ||
168 | 168 | ||
169 | // Autostart page | 169 | // Autostart page |
170 | ////////////////////////////////////////////////////// | 170 | ////////////////////////////////////////////////////// |
171 | QWidget *autostartPage = new QWidget( this ); | 171 | QWidget *autostartPage = new QWidget( this ); |
172 | QGridLayout *autostartLayout = new QGridLayout( autostartPage, 3, 2); | 172 | QGridLayout *autostartLayout = new QGridLayout( autostartPage, 3, 2); |
173 | 173 | ||
174 | i = 0; | 174 | i = 0; |
175 | 175 | ||
176 | autostartLineEdit = new KURLRequester(autostartPage, "autoStartLineEdit"); | 176 | autostartLineEdit = new KURLRequester(autostartPage, "autoStartLineEdit"); |
177 | QLabel* autostartLineLabel = new QLabel(autostartLineEdit, "Open this file automatically on startup:",autostartPage); | 177 | QLabel* autostartLineLabel = new QLabel(autostartLineEdit, "Open this file automatically on startup:",autostartPage); |
178 | autostartLayout->addMultiCellWidget(autostartLineLabel,i,i,0,1); | 178 | autostartLayout->addMultiCellWidget(autostartLineLabel,i,i,0,1); |
179 | ++i; | 179 | ++i; |
180 | autostartLayout->addMultiCellWidget(autostartLineEdit,i,i,0,1); | 180 | autostartLayout->addMultiCellWidget(autostartLineEdit,i,i,0,1); |
181 | ++i; | 181 | ++i; |
182 | 182 | ||
183 | sb = addWidBool(i18n("open deeplocked"), | 183 | sb = addWidBool(i18n("open deeplocked"), |
184 | &(prefs->mAutostartDeeplocked),autostartPage); | 184 | &(prefs->mAutostartDeeplocked),autostartPage); |
185 | autostartLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 185 | autostartLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
186 | ++i; | 186 | ++i; |
187 | 187 | ||
188 | 188 | ||
189 | // external app page | 189 | // external app page |
190 | ////////////////////////////////////////////////////// | 190 | ////////////////////////////////////////////////////// |
191 | QWidget *externalappPage = new QWidget( this ); | 191 | QWidget *externalappPage = new QWidget( this ); |
192 | QGridLayout *externalappLayout = new QGridLayout( externalappPage, 3, 2); | 192 | QGridLayout *externalappLayout = new QGridLayout( externalappPage, 3, 2); |
193 | 193 | ||
194 | i = 0; | 194 | i = 0; |
195 | 195 | ||
196 | browserLineEdit = new QLineEdit(externalappPage); | 196 | browserLineEdit = new QLineEdit(externalappPage); |
197 | QLabel* browserLineLabel = new QLabel(browserLineEdit, i18n("Favourite browser:"), externalappPage); | 197 | QLabel* browserLineLabel = new QLabel(browserLineEdit, i18n("Favourite browser:"), externalappPage); |
198 | externalappLayout->addWidget(browserLineLabel,i,0); | 198 | externalappLayout->addWidget(browserLineLabel,i,0); |
199 | externalappLayout->addWidget(browserLineEdit,i,1); | 199 | externalappLayout->addWidget(browserLineEdit,i,1); |
200 | ++i; | 200 | ++i; |
201 | 201 | ||
202 | xtermLineEdit = new QLineEdit(externalappPage); | 202 | xtermLineEdit = new QLineEdit(externalappPage); |
203 | QLabel* xtermLineLabel = new QLabel(xtermLineEdit, i18n("Favourite x-terminal:"), externalappPage); | 203 | QLabel* xtermLineLabel = new QLabel(xtermLineEdit, i18n("Favourite x-terminal:"), externalappPage); |
204 | externalappLayout->addWidget(xtermLineLabel,i,0); | 204 | externalappLayout->addWidget(xtermLineLabel,i,0); |
205 | externalappLayout->addWidget(xtermLineEdit,i,1); | 205 | externalappLayout->addWidget(xtermLineEdit,i,1); |
206 | ++i; | 206 | ++i; |
207 | 207 | ||
208 | 208 | ||
209 | // miscelaneous page | 209 | // miscelaneous page |
210 | ////////////////////////////////////////////////////// | 210 | ////////////////////////////////////////////////////// |
211 | QWidget *miscPage = new QWidget( this ); | 211 | QWidget *miscPage = new QWidget( this ); |
212 | QGridLayout *miscLayout = new QGridLayout( miscPage, 3, 2); | 212 | QGridLayout *miscLayout = new QGridLayout( miscPage, 3, 2); |
213 | 213 | ||
214 | i = 0; | 214 | i = 0; |
215 | 215 | ||
216 | /*US ENH: PWM/Pi has no tray and con be minimized | ||
216 | sb = addWidBool(i18n("Show icon in system-tray"),&(prefs->mTray),miscPage); | 217 | sb = addWidBool(i18n("Show icon in system-tray"),&(prefs->mTray),miscPage); |
217 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 218 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
218 | ++i; | 219 | ++i; |
219 | 220 | */ | |
220 | 221 | ||
221 | sb = addWidBool(i18n("Open document with passwords unlocked"),&(prefs->mUnlockOnOpen),miscPage); | 222 | sb = addWidBool(i18n("Open document with passwords unlocked"),&(prefs->mUnlockOnOpen),miscPage); |
222 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 223 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
223 | ++i; | 224 | ++i; |
224 | 225 | ||
226 | /*US ENH: PWM/Pi has no tray and con be minimized | ||
225 | sb = addWidBool(i18n("auto-minimize to tray on startup"),&(prefs->mAutoMinimizeOnStart),miscPage); | 227 | sb = addWidBool(i18n("auto-minimize to tray on startup"),&(prefs->mAutoMinimizeOnStart),miscPage); |
226 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 228 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
227 | sb->checkBox()->setEnabled (FALSE); | ||
228 | ++i; | 229 | ++i; |
229 | 230 | ||
230 | KPrefsWidRadios * minimizeRadio = addWidRadios(i18n("auto-lock on minimize:") ,&(prefs->mMinimizeLock), miscPage); | 231 | KPrefsWidRadios * minimizeRadio = addWidRadios(i18n("auto-lock on minimize:") ,&(prefs->mMinimizeLock), miscPage); |
231 | minimizeRadio->addRadio(i18n("don't lock")); | 232 | minimizeRadio->addRadio(i18n("don't lock")); |
232 | minimizeRadio->addRadio(i18n("normal lock")); | 233 | minimizeRadio->addRadio(i18n("normal lock")); |
233 | minimizeRadio->addRadio(i18n("deep-lock")); | 234 | minimizeRadio->addRadio(i18n("deep-lock")); |
234 | miscLayout->addMultiCellWidget( (QWidget*)minimizeRadio->groupBox(),i,i,0,2); | 235 | miscLayout->addMultiCellWidget( (QWidget*)minimizeRadio->groupBox(),i,i,0,2); |
235 | ++i; | 236 | ++i; |
236 | 237 | ||
237 | sb = addWidBool(i18n("KWallet emulation"),&(prefs->mKWalletEmu),miscPage); | 238 | sb = addWidBool(i18n("KWallet emulation"),&(prefs->mKWalletEmu),miscPage); |
238 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 239 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
239 | ++i; | 240 | ++i; |
240 | 241 | ||
241 | sb = addWidBool(i18n("Close instead Minimize into tray"),&(prefs->mClose),miscPage); | 242 | sb = addWidBool(i18n("Close instead Minimize into tray"),&(prefs->mClose),miscPage); |
242 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 243 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
243 | ++i; | 244 | ++i; |
244 | 245 | */ | |
245 | 246 | ||
246 | 247 | ||
247 | tabWidget->addTab( windowStylePage, i18n( "Look && feel" ) ); | 248 | tabWidget->addTab( windowStylePage, i18n( "Look && feel" ) ); |
248 | tabWidget->addTab( filePage, i18n( "File" ) ); | 249 | tabWidget->addTab( filePage, i18n( "File" ) ); |
249 | tabWidget->addTab( timeoutPage, i18n( "Timeout" ) ); | 250 | tabWidget->addTab( timeoutPage, i18n( "Timeout" ) ); |
250 | tabWidget->addTab( autostartPage, i18n( "Autostart" ) ); | 251 | tabWidget->addTab( autostartPage, i18n( "Autostart" ) ); |
251 | tabWidget->addTab( externalappPage, i18n( "External apps" ) ); | 252 | tabWidget->addTab( externalappPage, i18n( "External apps" ) ); |
252 | tabWidget->addTab( miscPage, i18n( "Miscellaneous" ) ); | 253 | tabWidget->addTab( miscPage, i18n( "Miscellaneous" ) ); |
253 | 254 | ||
254 | 255 | ||
255 | connect( permissionLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); | 256 | connect( permissionLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); |
256 | connect( pwTimeoutSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( modified() ) ); | 257 | connect( pwTimeoutSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( modified() ) ); |
257 | connect( lockTimeoutSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( modified() ) ); | 258 | connect( lockTimeoutSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( modified() ) ); |
258 | connect( autostartLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); | 259 | connect( autostartLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); |
259 | connect( browserLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); | 260 | connect( browserLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); |
260 | connect( xtermLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); | 261 | connect( xtermLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); |
261 | 262 | ||
262 | } | 263 | } |
263 | 264 | ||
264 | 265 | ||
265 | void PWMConfigWidget::usrReadConfig() | 266 | void PWMConfigWidget::usrReadConfig() |
266 | { | 267 | { |
267 | PWMPrefs* prefs = PWMPrefs::instance(); | 268 | PWMPrefs* prefs = PWMPrefs::instance(); |
268 | 269 | ||
269 | 270 | ||
270 | setFilePermissions(prefs->mFilePermissions); | 271 | setFilePermissions(prefs->mFilePermissions); |
271 | 272 | ||
272 | pwTimeoutSpinBox->setValue(prefs->mPwTimeout); | 273 | pwTimeoutSpinBox->setValue(prefs->mPwTimeout); |
273 | lockTimeoutSpinBox->setValue(prefs->mLockTimeout); | 274 | lockTimeoutSpinBox->setValue(prefs->mLockTimeout); |
274 | autostartLineEdit->setURL(prefs->mAutoStart); | 275 | autostartLineEdit->setURL(prefs->mAutoStart); |
275 | browserLineEdit->setText(prefs->mBrowserCommand); | 276 | browserLineEdit->setText(prefs->mBrowserCommand); |
276 | xtermLineEdit->setText(prefs->mXTermCommand); | 277 | xtermLineEdit->setText(prefs->mXTermCommand); |
277 | 278 | ||
278 | kcfg_compression->setCurrentItem(prefs->mCompression); | 279 | kcfg_compression->setCurrentItem(prefs->mCompression); |
279 | kcfg_cryptAlgo->setCurrentItem(prefs->mCryptAlgo); | 280 | kcfg_cryptAlgo->setCurrentItem(prefs->mCryptAlgo); |
280 | kcfg_hashAlgo->setCurrentItem(prefs->mHashAlgo); | 281 | kcfg_hashAlgo->setCurrentItem(prefs->mHashAlgo); |
281 | } | 282 | } |
282 | 283 | ||
283 | void PWMConfigWidget::usrWriteConfig() | 284 | void PWMConfigWidget::usrWriteConfig() |
284 | { | 285 | { |
285 | PWMPrefs* prefs = PWMPrefs::instance(); | 286 | PWMPrefs* prefs = PWMPrefs::instance(); |
286 | 287 | ||
287 | prefs->mFilePermissions = getFilePermissions(); | 288 | prefs->mFilePermissions = getFilePermissions(); |
288 | 289 | ||
289 | prefs->mPwTimeout = pwTimeoutSpinBox->value(); | 290 | prefs->mPwTimeout = pwTimeoutSpinBox->value(); |
290 | prefs->mLockTimeout = lockTimeoutSpinBox->value(); | 291 | prefs->mLockTimeout = lockTimeoutSpinBox->value(); |
291 | prefs->mAutoStart = autostartLineEdit->url(); | 292 | prefs->mAutoStart = autostartLineEdit->url(); |
292 | 293 | ||
293 | prefs->mBrowserCommand = browserLineEdit->text(); | 294 | prefs->mBrowserCommand = browserLineEdit->text(); |
294 | prefs->mXTermCommand = xtermLineEdit->text(); | 295 | prefs->mXTermCommand = xtermLineEdit->text(); |
295 | 296 | ||
296 | prefs->mCompression = kcfg_compression->currentItem(); | 297 | prefs->mCompression = kcfg_compression->currentItem(); |
297 | prefs->mCryptAlgo = kcfg_cryptAlgo->currentItem(); | 298 | prefs->mCryptAlgo = kcfg_cryptAlgo->currentItem(); |
298 | prefs->mHashAlgo = kcfg_hashAlgo->currentItem(); | 299 | prefs->mHashAlgo = kcfg_hashAlgo->currentItem(); |
299 | 300 | ||
300 | } | 301 | } |
301 | 302 | ||
302 | int PWMConfigWidget::getFilePermissions() | 303 | int PWMConfigWidget::getFilePermissions() |
303 | { | 304 | { |
304 | char octalDigits[] = "01234567"; | 305 | char octalDigits[] = "01234567"; |
305 | bool isOctal; | 306 | bool isOctal; |
306 | QString permString(permissionLineEdit->text()); | 307 | QString permString(permissionLineEdit->text()); |
307 | int i, j, length = permString.length(); | 308 | int i, j, length = permString.length(); |
308 | if (length != 3) { | 309 | if (length != 3) { |
309 | printWarn("Wrong permission string length! Please enter " | 310 | printWarn("Wrong permission string length! Please enter " |
310 | "the string like the following example: 600"); | 311 | "the string like the following example: 600"); |
311 | return CONF_DEFAULT_FILEPERMISSIONS; | 312 | return CONF_DEFAULT_FILEPERMISSIONS; |
312 | } | 313 | } |
313 | for (i = 0; i < length; ++i) { | 314 | for (i = 0; i < length; ++i) { |
314 | isOctal = false; | 315 | isOctal = false; |
315 | for (j = 0; j < 8; ++j) { | 316 | for (j = 0; j < 8; ++j) { |
316 | if (permString.at(i) == octalDigits[j]) { | 317 | if (permString.at(i) == octalDigits[j]) { |
317 | isOctal = true; | 318 | isOctal = true; |
318 | break; | 319 | break; |
319 | } | 320 | } |
320 | } | 321 | } |
321 | if (!isOctal) { | 322 | if (!isOctal) { |
322 | printWarn("CONFIG: File-permissions: This is " | 323 | printWarn("CONFIG: File-permissions: This is " |
323 | "not an octal number "); | 324 | "not an octal number "); |
324 | return CONF_DEFAULT_FILEPERMISSIONS; | 325 | return CONF_DEFAULT_FILEPERMISSIONS; |
325 | } | 326 | } |
326 | } | 327 | } |
327 | 328 | ||
328 | int ret = strtol(permString.latin1(), 0, 8); | 329 | int ret = strtol(permString.latin1(), 0, 8); |
329 | if (ret == 0) { | 330 | if (ret == 0) { |
330 | /* either an error occured, or the user did really type 000 */ | 331 | /* either an error occured, or the user did really type 000 */ |
331 | printWarn("CONFIG: File-permissions: Hm, either conversion error, " | 332 | printWarn("CONFIG: File-permissions: Hm, either conversion error, " |
332 | "or you really typed 000. 8-)"); | 333 | "or you really typed 000. 8-)"); |
333 | return CONF_DEFAULT_FILEPERMISSIONS; | 334 | return CONF_DEFAULT_FILEPERMISSIONS; |
334 | } | 335 | } |
335 | return ret; | 336 | return ret; |
336 | } | 337 | } |
337 | 338 | ||
338 | void PWMConfigWidget::setFilePermissions(int perm) | 339 | void PWMConfigWidget::setFilePermissions(int perm) |
339 | { | 340 | { |
340 | char tmpBuf[30]; | 341 | char tmpBuf[30]; |
341 | sprintf(tmpBuf, "%o", perm); | 342 | sprintf(tmpBuf, "%o", perm); |
342 | permissionLineEdit->setText(tmpBuf); | 343 | permissionLineEdit->setText(tmpBuf); |
343 | } | 344 | } |
344 | 345 | ||
345 | 346 | ||
346 | 347 | ||
347 | #ifndef PWM_EMBEDDED | 348 | #ifndef PWM_EMBEDDED |
348 | #include "pwmconfigwidget.moc" | 349 | #include "pwmconfigwidget.moc" |
349 | #endif //PWM_EMBEDDED | 350 | #endif //PWM_EMBEDDED |
350 | 351 | ||
diff --git a/pwmanager/pwmanager/pwmprefs.h b/pwmanager/pwmanager/pwmprefs.h index 1c8b982..5b8f9d8 100644 --- a/pwmanager/pwmanager/pwmprefs.h +++ b/pwmanager/pwmanager/pwmprefs.h | |||
@@ -1,163 +1,163 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of PwManager/Pi | 2 | This file is part of PwManager/Pi |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifndef PWMPREFS_H | 26 | #ifndef PWMPREFS_H |
27 | #define PWMPREFS_H | 27 | #define PWMPREFS_H |
28 | 28 | ||
29 | #include <qstringlist.h> | 29 | #include <qstringlist.h> |
30 | #include <qsize.h> | 30 | #include <qsize.h> |
31 | 31 | ||
32 | #include <kpimprefs.h> | 32 | #include <kpimprefs.h> |
33 | 33 | ||
34 | class KConfig; | 34 | class KConfig; |
35 | 35 | ||
36 | #define conf() PWMPrefs::instance() | 36 | #define conf() PWMPrefs::instance() |
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | 40 | ||
41 | #define CONF_DEFAULT_PWTIMEOUT 10/* 10 sec */ | 41 | #define CONF_DEFAULT_PWTIMEOUT 10/* 10 sec */ |
42 | #define CONF_DEFAULT_LOCKTIMEOUT 0/* 0 == disable */ | 42 | #define CONF_DEFAULT_LOCKTIMEOUT 0/* 0 == disable */ |
43 | #define CONF_DEFAULT_TRAY true | 43 | #define CONF_DEFAULT_TRAY false |
44 | #define CONF_DEFAULT_UNLOCKONOPEN true | 44 | #define CONF_DEFAULT_UNLOCKONOPEN true |
45 | #define CONF_DEFAULT_MAINVIEWSTYLE 1/* Category List Left */ | 45 | #define CONF_DEFAULT_MAINVIEWSTYLE 1/* Category List Left */ |
46 | #define CONF_DEFAULT_COMPRESSION 0x01/* gzip */ | 46 | #define CONF_DEFAULT_COMPRESSION 0x01/* gzip */ |
47 | #define CONF_DEFAULT_CRYPTALGO (0x01 - 1)/* blowfish */ | 47 | #define CONF_DEFAULT_CRYPTALGO (0x01 - 1)/* blowfish */ |
48 | #define CONF_DEFAULT_HASHALGO (0x01 - 1)/* sha1 */ | 48 | #define CONF_DEFAULT_HASHALGO (0x01 - 1)/* sha1 */ |
49 | #define CONF_DEFAULT_AUTOMINIMIZE false | 49 | #define CONF_DEFAULT_AUTOMINIMIZE false |
50 | #define CONF_DEFAULT_BROWSERCOMMAND "" | 50 | #define CONF_DEFAULT_BROWSERCOMMAND "" |
51 | #define CONF_DEFAULT_XTERMCOMMAND "konsole -e" | 51 | #define CONF_DEFAULT_XTERMCOMMAND "konsole -e" |
52 | #define CONF_DEFAULT_FILEPERMISSIONS 0600 | 52 | #define CONF_DEFAULT_FILEPERMISSIONS 0600 |
53 | #define CONF_DEFAULT_MAKEFILEBACKUP false | 53 | #define CONF_DEFAULT_MAKEFILEBACKUP false |
54 | #define CONF_DEFAULT_AUTOSTART_DEEPL true | 54 | #define CONF_DEFAULT_AUTOSTART_DEEPL true |
55 | #define CONF_DEFAULT_AUTODEEPLOCK true | 55 | #define CONF_DEFAULT_AUTODEEPLOCK true |
56 | #define CONF_DEFAULT_KWALLETEMU true | 56 | #define CONF_DEFAULT_KWALLETEMU false |
57 | #define CONF_DEFAULT_MINIMIZELOCK 2/* deep-lock */ | 57 | #define CONF_DEFAULT_MINIMIZELOCK 2/* deep-lock */ |
58 | #define CONF_DEFAULT_NEWENTRLOCKSTAT false/* new entries unlocked */ | 58 | #define CONF_DEFAULT_NEWENTRLOCKSTAT false/* new entries unlocked */ |
59 | #define CONF_DEFAULT_WNDCLOSE true/* don't minimize to tray */ | 59 | #define CONF_DEFAULT_WNDCLOSE true/* don't minimize to tray */ |
60 | 60 | ||
61 | 61 | ||
62 | class PWMPrefs : public KPimPrefs | 62 | class PWMPrefs : public KPimPrefs |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | virtual ~PWMPrefs(); | 65 | virtual ~PWMPrefs(); |
66 | 66 | ||
67 | static PWMPrefs *instance(); | 67 | static PWMPrefs *instance(); |
68 | 68 | ||
69 | public: | 69 | public: |
70 | /* functions for reading the configuration settings */ | 70 | /* functions for reading the configuration settings */ |
71 | /* GLOBAL */ | 71 | /* GLOBAL */ |
72 | QString confGlobAutoStart(); | 72 | QString confGlobAutoStart(); |
73 | QString confGlobBrowserCommand(); | 73 | QString confGlobBrowserCommand(); |
74 | QString confGlobXtermCommand(); | 74 | QString confGlobXtermCommand(); |
75 | QFont confGlobEntryFont(); | 75 | QFont confGlobEntryFont(); |
76 | int confGlobPwTimeout(); | 76 | int confGlobPwTimeout(); |
77 | int confGlobLockTimeout(); | 77 | int confGlobLockTimeout(); |
78 | int confGlobCompression(); | 78 | int confGlobCompression(); |
79 | int confGlobCryptAlgo(); | 79 | int confGlobCryptAlgo(); |
80 | int confGlobHashAlgo(); | 80 | int confGlobHashAlgo(); |
81 | int confGlobFilePermissions(); | 81 | int confGlobFilePermissions(); |
82 | int confGlobMinimizeLock(); | 82 | int confGlobMinimizeLock(); |
83 | bool confGlobUnlockOnOpen(); | 83 | bool confGlobUnlockOnOpen(); |
84 | bool confGlobTray(); | 84 | bool confGlobTray(); |
85 | bool confGlobMakeFileBackup(); | 85 | bool confGlobMakeFileBackup(); |
86 | bool confGlobAutostartDeepLocked(); | 86 | bool confGlobAutostartDeepLocked(); |
87 | bool confGlobAutoDeepLock(); | 87 | bool confGlobAutoDeepLock(); |
88 | bool confGlobKwalletEmu(); | 88 | bool confGlobKwalletEmu(); |
89 | bool confGlobNewEntrLockStat(); | 89 | bool confGlobNewEntrLockStat(); |
90 | /* WND */ | 90 | /* WND */ |
91 | QSize confWndMainWndSize(); | 91 | QSize confWndMainWndSize(); |
92 | int confWndMainViewStyle(); | 92 | int confWndMainViewStyle(); |
93 | bool confWndAutoMinimizeOnStart(); | 93 | bool confWndAutoMinimizeOnStart(); |
94 | bool confWndClose(); | 94 | bool confWndClose(); |
95 | 95 | ||
96 | public: | 96 | public: |
97 | /* functions for writing the configuration settings */ | 97 | /* functions for writing the configuration settings */ |
98 | /* GLOBAL */ | 98 | /* GLOBAL */ |
99 | void confGlobAutoStart(const QString &e); | 99 | void confGlobAutoStart(const QString &e); |
100 | void confGlobBrowserCommand(const QString &e); | 100 | void confGlobBrowserCommand(const QString &e); |
101 | void confGlobXtermCommand(const QString &e); | 101 | void confGlobXtermCommand(const QString &e); |
102 | void confGlobEntryFont(const QFont &e); | 102 | void confGlobEntryFont(const QFont &e); |
103 | void confGlobPwTimeout(int e); | 103 | void confGlobPwTimeout(int e); |
104 | void confGlobLockTimeout(int e); | 104 | void confGlobLockTimeout(int e); |
105 | void confGlobCompression(int e); | 105 | void confGlobCompression(int e); |
106 | void confGlobCryptAlgo(int e); | 106 | void confGlobCryptAlgo(int e); |
107 | void confGlobHashAlgo(int e); | 107 | void confGlobHashAlgo(int e); |
108 | 108 | ||
109 | void confGlobFilePermissions(int e); | 109 | void confGlobFilePermissions(int e); |
110 | void confGlobMinimizeLock(int e); | 110 | void confGlobMinimizeLock(int e); |
111 | void confGlobUnlockOnOpen(bool e); | 111 | void confGlobUnlockOnOpen(bool e); |
112 | void confGlobTray(bool e); | 112 | void confGlobTray(bool e); |
113 | void confGlobMakeFileBackup(bool e); | 113 | void confGlobMakeFileBackup(bool e); |
114 | void confGlobAutostartDeepLocked(bool e); | 114 | void confGlobAutostartDeepLocked(bool e); |
115 | void confGlobAutoDeepLock(bool e); | 115 | void confGlobAutoDeepLock(bool e); |
116 | void confGlobKwalletEmu(bool e); | 116 | void confGlobKwalletEmu(bool e); |
117 | void confGlobNewEntrLockStat(bool e); | 117 | void confGlobNewEntrLockStat(bool e); |
118 | /* WND */ | 118 | /* WND */ |
119 | void confWndMainWndSize(const QSize &e); | 119 | void confWndMainWndSize(const QSize &e); |
120 | void confWndMainViewStyle(int e); | 120 | void confWndMainViewStyle(int e); |
121 | void confWndAutoMinimizeOnStart(bool e); | 121 | void confWndAutoMinimizeOnStart(bool e); |
122 | void confWndClose(bool e); | 122 | void confWndClose(bool e); |
123 | 123 | ||
124 | 124 | ||
125 | 125 | ||
126 | QString mAutoStart; | 126 | QString mAutoStart; |
127 | QString mBrowserCommand; | 127 | QString mBrowserCommand; |
128 | QString mXTermCommand; | 128 | QString mXTermCommand; |
129 | QFont mEntryFont; | 129 | QFont mEntryFont; |
130 | int mPwTimeout; | 130 | int mPwTimeout; |
131 | int mLockTimeout; | 131 | int mLockTimeout; |
132 | int mCompression; | 132 | int mCompression; |
133 | int mCryptAlgo; | 133 | int mCryptAlgo; |
134 | int mHashAlgo; | 134 | int mHashAlgo; |
135 | int mFilePermissions; | 135 | int mFilePermissions; |
136 | int mMinimizeLock; | 136 | int mMinimizeLock; |
137 | bool mUnlockOnOpen; | 137 | bool mUnlockOnOpen; |
138 | bool mTray; | 138 | bool mTray; |
139 | bool mMakeFileBackup; | 139 | bool mMakeFileBackup; |
140 | bool mAutostartDeeplocked; | 140 | bool mAutostartDeeplocked; |
141 | bool mAutoDeeplock; | 141 | bool mAutoDeeplock; |
142 | bool mKWalletEmu; | 142 | bool mKWalletEmu; |
143 | bool mNewEntrLockStat; | 143 | bool mNewEntrLockStat; |
144 | QSize mMainWndSize; | 144 | QSize mMainWndSize; |
145 | int mMainViewStyle; | 145 | int mMainViewStyle; |
146 | bool mAutoMinimizeOnStart; | 146 | bool mAutoMinimizeOnStart; |
147 | bool mClose; | 147 | bool mClose; |
148 | 148 | ||
149 | //US ENH | 149 | //US ENH |
150 | QValueList<int> mCommentSplitter; | 150 | QValueList<int> mCommentSplitter; |
151 | QValueList<int> mCategorySplitter; | 151 | QValueList<int> mCategorySplitter; |
152 | 152 | ||
153 | 153 | ||
154 | // US introduce a nonconst way to return the config object. | 154 | // US introduce a nonconst way to return the config object. |
155 | KConfig* getConfig(); | 155 | KConfig* getConfig(); |
156 | 156 | ||
157 | private: | 157 | private: |
158 | PWMPrefs(); | 158 | PWMPrefs(); |
159 | 159 | ||
160 | static PWMPrefs *sInstance; | 160 | static PWMPrefs *sInstance; |
161 | }; | 161 | }; |
162 | 162 | ||
163 | #endif | 163 | #endif |